Add new event onFatalException and listen to it in problems plugin

This commit is contained in:
Matias Griese
2014-08-06 12:51:49 +03:00
committed by Djamil Legato
parent ce68c36910
commit b5982ea965
6 changed files with 71 additions and 38 deletions

View File

@@ -71,6 +71,41 @@ class ProblemsPlugin extends Plugin
Registry::get('Twig')->twig_paths[] = __DIR__ . '/templates';
}
/**
*
*/
public function onFatalException($e)
{
// Run through potential issues
if ($this->problemChecker()) {
foreach ($this->results as $key => $result) {
if ($key == 'files') {
foreach ($result as $filename => $status) {
if (key($status)) {
continue;
}
$text = reset($status);
echo "<div>{$filename} {$text}</div>";
}
} else {
if (key($status)) {
continue;
}
$text = reset($status);
echo "<div>{$text}</div>";
}
}
// Create Required Folders if they don't exist
if (!is_dir(LOG_DIR)) mkdir(LOG_DIR);
if (!is_dir(CACHE_DIR)) mkdir(CACHE_DIR);
if (!is_dir(IMAGES_DIR)) mkdir(IMAGES_DIR);
if (!is_dir(DATA_DIR)) mkdir(DATA_DIR);
exit();
}
}
/**
* Set needed variables to display the problems.
*/