Errors/Logging

* log addNotes to DB as php user-errors
  * always skip the native php error handler
This commit is contained in:
Sarjuuk
2015-07-18 16:45:11 +02:00
parent 58a235e2e3
commit 998763be7b
11 changed files with 44 additions and 45 deletions

View File

@@ -218,7 +218,7 @@ class EventPage extends GenericPage
if ($v > 0)
$list[] = $v;
else if ($v === null)
Util::addNote(U_GROUP_EMPLOYEE, 'game_event_prerequisite: this event has itself as prerequisite');
Util::logError('game_event_prerequisite: this event has itself as prerequisite');
});
if ($list)

View File

@@ -323,6 +323,8 @@ class GenericPage
// display occured notices
if ($_ = Util::getNotes())
{
array_unshift($_, 'One or more errors occured, while generating this page.');
$this->announcements[0] = array(
'parent' => 'announcement-0',
'id' => 0,

View File

@@ -355,7 +355,7 @@ class ItemPage extends genericPage
}
else
{
Util::addNote(U_GROUP_STAFF, 'Referenced PageTextId #'.$next.' is not in DB');
Util::logError('Referenced PageTextId #'.$next.' is not in DB');
break;
}
}

View File

@@ -509,7 +509,7 @@ class NpcPage extends GenericPage
}
}
else
Util::addNote(U_GROUP_EMPLOYEE, 'NPC '.$this->typeId.' is flagged as trainer, but doesn\'t have any spells set');
Util::logError('NPC '.$this->typeId.' is flagged as trainer, but doesn\'t have any spells set');
}
// tab: sells

View File

@@ -213,7 +213,7 @@ class ObjectPage extends GenericPage
}
else
{
Util::addNote(U_GROUP_STAFF, 'Referenced PageTextId #'.$next.' is not in DB');
Util::logError('Referenced PageTextId #'.$next.' is not in DB');
break;
}
}

View File

@@ -35,7 +35,7 @@ class ScreenshotPage extends GenericPage
if ($this->minSize <= 0)
{
Util::addNote(U_GROUP_EMPLOYEE, 'ScreenshotPage::__construct() - config error: dimensions for uploaded screenshots egual or less than zero. Value forced to 200');
Util::logError('config error: dimensions for uploaded screenshots equal or less than zero. Value forced to 200');
$this->minSize = 200;
}
@@ -276,26 +276,26 @@ class ScreenshotPage extends GenericPage
switch ($_FILES['screenshotfile']['error'])
{
case 1:
Util::addNote(U_GROUP_EMPLOYEE, 'ScreenshotPage::validateScreenshot() - the file exceeds the maximum size of '.ini_get('upload_max_filesize'));
Util::logError('validateScreenshot - the file exceeds the maximum size of '.ini_get('upload_max_filesize'));
return Lang::screenshot('error', 'selectSS');
case 3:
Util::addNote(U_GROUP_EMPLOYEE, 'ScreenshotPage::validateScreenshot() - upload was interrupted');
Util::logError('validateScreenshot - upload was interrupted');
return Lang::screenshot('error', 'selectSS');
case 4:
Util::addNote(U_GROUP_EMPLOYEE, 'ScreenshotPage::validateScreenshot() - no file was received');
Util::logError('validateScreenshot() - no file was received');
return Lang::screenshot('error', 'selectSS');
case 6:
Util::addNote(U_GROUP_EMPLOYEE, 'ScreenshotPage::validateScreenshot() - temporary upload directory is not set');
Util::logError('validateScreenshot - temporary upload directory is not set');
return Lang::main('intError');
case 7:
Util::addNote(U_GROUP_EMPLOYEE, 'ScreenshotPage::validateScreenshot() - could not write temporary file to disk');
Util::logError('validateScreenshot - could not write temporary file to disk');
return Lang::main('intError');
}
// points to invalid file (hack attempt)
if (!is_uploaded_file($_FILES['screenshotfile']['tmp_name']))
{
Util::addNote(U_GROUP_EMPLOYEE, 'ScreenshotPage::validateScreenshot() - uploaded file not in upload directory');
Util::logError('validateScreenshot - uploaded file not in upload directory');
return Lang::main('intError');
}