commit 82680e9277f8dfa996bf7c4ff2f83f1e08591555
parent b314a39c4760055985f8610fc82b3728b7a70450
Author: Jan Dankert <devnull@localhost>
Date: Sat, 30 Dec 2017 21:32:18 +0100
Nachzügler für bessers Exceptionhandling. Und ein Tippfuhler in Folder.class behoben.
Diffstat:
3 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/dav/Logger.class.php b/dav/Logger.class.php
@@ -17,14 +17,14 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-define('DAV_LOG_LEVEL_TRACE',5 );
-define('DAV_LOG_LEVEL_DEBUG',4 );
-define('DAV_LOG_LEVEL_INFO' ,3 );
-define('DAV_LOG_LEVEL_WARN' ,2 );
-define('DAV_LOG_LEVEL_ERROR',1 );
+define('DAV_LOG_LEVEL_TRACE',5 );
+define('DAV_LOG_LEVEL_DEBUG',4 );
+define('DAV_LOG_LEVEL_INFO' ,3 );
+define('DAV_LOG_LEVEL_WARN' ,2 );
+define('DAV_LOG_LEVEL_ERROR',1 );
+
+define('DAV_LOG_LEVEL', constant('DAV_LOG_LEVEL_'.strtoupper($config['log.level'])));
-define('DAV_LOG_LEVEL', constant('DAV_LOG_LEVEL_'.strtoupper($config['log.level'])));
-
/**
* Schreiben eines Eintrages in die Logdatei
@@ -113,7 +113,7 @@ class Logger
return;
if ( ! is_writable($filename) )
- Http::serverError( "logfile $filename is not writable by the server" );
+ throw new \LogicException( "logfile $filename is not writable by the server" );
$thisLevel = strtoupper($facility);
@@ -122,7 +122,7 @@ class Logger
// Ersetzen von Variablen
$text = str_replace( '%host',getenv('REMOTE_ADDR'),$text );
- $action = strtoupper($_SERVER['REQUEST_METHOD']);
+ $action = strtoupper($_SERVER['REQUEST_METHOD']);
$text = str_replace( '%level' ,str_pad($thisLevel,5),$text );
$text = str_replace( '%agent' ,getenv('HTTP_USER_AGENT'),$text );
diff --git a/db/DbUpdate.class.php b/db/DbUpdate.class.php
@@ -22,10 +22,10 @@ class DbUpdate
if ( $version > OR_DB_SUPPORTED_VERSION )
// Oh oh, in der Datenbank ist eine neue Version, als wir unterstüzten.
- Http::serverError('Actual DB version is not supported.',"DB-Version is $version, but this is OpenRat ".OR_VERSION." which only supports version ".OR_DB_SUPPORTED_VERSION );
+ throw new \LogicException('Actual DB version is not supported.',"DB-Version is $version, but this is OpenRat ".OR_VERSION." which only supports version ".OR_DB_SUPPORTED_VERSION );
if ( ! $db->conf['auto_update'])
- Http::serverError('DB Update necessary.',"DB-Version is $version. Auto-Update is disabled, but this is OpenRat ".OR_VERSION." needs the version ".OR_DB_SUPPORTED_VERSION );
+ throw new \LogicException('DB Update necessary.',"DB-Version is $version. Auto-Update is disabled, but this is OpenRat ".OR_VERSION." needs the version ".OR_DB_SUPPORTED_VERSION );
for( $installVersion = $version + 1; $installVersion <= OR_DB_SUPPORTED_VERSION; $installVersion++ )
{
@@ -81,7 +81,7 @@ SQL
,$db->id);
$countErrors = $sql->getOne();
if ( $countErrors > 0 )
- Http::serverError('Database error','there are dirty versions (means: versions with status 0), see table VERSION for details.');
+ throw new \LogicException('Database error','there are dirty versions (means: versions with status 0), see table VERSION for details.');
// Aktuelle Version ermitteln.
$sql = $db->sql(<<<SQL
diff --git a/modules/cms-core/model/Folder.class.php b/modules/cms-core/model/Folder.class.php
@@ -668,7 +668,7 @@ SQL
$row = $sql->getRow();
if ( in_array($row['id'],$idCache))
- \throw new \LogicException('fatal: parent-rekursion in object-id: '.$this->objectid.', double-parent-id: '.$row['id']);
+ throw new \LogicException('fatal: parent-rekursion in object-id: '.$this->objectid.', double-parent-id: '.$row['id']);
else
$idCache[] = $row['id'];
@@ -707,7 +707,7 @@ SQL
$row = $sql->getRow();
if ( in_array($row['id'],$idCache))
- \throw new \LogicException('fatal: parent-rekursion in object-id: '.$this->objectid.', double-parent-id: '.$row['id']);
+ throw new \LogicException('fatal: parent-rekursion in object-id: '.$this->objectid.', double-parent-id: '.$row['id']);
else
$idCache[] = $row['id'];