Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattab <matthieu.aubry@gmail.com>2013-12-26 01:42:07 +0400
committermattab <matthieu.aubry@gmail.com>2013-12-26 01:42:07 +0400
commit8318219cad363e3430080b0609fa281227dc7892 (patch)
treecfe882bba3ed267117b5b443c3a52a88f096ee76
parent58ee8846720a23044695671564291ce31327eab2 (diff)
Refs #4439 Registering the callback in the frontcontroller and using a static method rather than a closure
-rw-r--r--core/FrontController.php19
-rw-r--r--index.php13
2 files changed, 19 insertions, 13 deletions
diff --git a/core/FrontController.php b/core/FrontController.php
index 22fa669861..d02f00b96e 100644
--- a/core/FrontController.php
+++ b/core/FrontController.php
@@ -53,7 +53,7 @@ use Piwik\Session;
*
* @package Piwik
* @subpackage FrontController
- * @static method \Piwik\FrontController getInstance()
+ * @method static \Piwik\FrontController getInstance()
*/
class FrontController extends Singleton
{
@@ -244,6 +244,23 @@ class FrontController extends Singleton
|| SettingsServer::isArchivePhpTriggered();
}
+ static public function setUpSafeMode()
+ {
+ register_shutdown_function(array('\\Piwik\\FrontController','triggerSafeModeWhenError'));
+ }
+
+ static public function triggerSafeModeWhenError()
+ {
+ $lastError = error_get_last();
+ if (!empty($lastError) && $lastError['type'] == E_ERROR) {
+ $controller = FrontController::getInstance();
+ $controller->init();
+ $message = $controller->dispatch('CorePluginsAdmin', 'safemode', array($lastError));
+
+ echo $message;
+ }
+ }
+
/**
* Loads the config file and assign to the global registry
* This is overridden in tests to ensure test config file is used
diff --git a/index.php b/index.php
index 892050501c..bde70bb7ba 100644
--- a/index.php
+++ b/index.php
@@ -54,18 +54,7 @@ if (!defined('PIWIK_ENABLE_ERROR_HANDLER') || PIWIK_ENABLE_ERROR_HANDLER) {
ExceptionHandler::setUp();
}
-register_shutdown_function(function () {
-
- $lastError = error_get_last();
-
- if (!empty($lastError) && $lastError['type'] == E_ERROR) {
- $controller = FrontController::getInstance();
- $controller->init();
- $message = $controller->dispatch('CorePluginsAdmin', 'safemode', array($lastError));
-
- echo $message;
- }
-});
+FrontController::setUpSafeMode();
if (!defined('PIWIK_ENABLE_DISPATCH') || PIWIK_ENABLE_DISPATCH) {
$controller = FrontController::getInstance();