mirror of
https://github.com/getgrav/grav.git
synced 2026-01-21 15:03:34 +01:00
Add new event onFatalException and listen to it in problems plugin
This commit is contained in:
committed by
Djamil Legato
parent
ce68c36910
commit
b5982ea965
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user