diff --git a/core/Plugin/ControllerAdmin.php b/core/Plugin/ControllerAdmin.php index 41c14ff67ba..72ef9002874 100644 --- a/core/Plugin/ControllerAdmin.php +++ b/core/Plugin/ControllerAdmin.php @@ -27,6 +27,8 @@ */ abstract class ControllerAdmin extends Controller { + private static $isEacceleratorUsed = false; + private static function notifyWhenTrackingStatisticsDisabled() { $statsEnabled = PiwikConfig::getInstance()->Tracker['record_statistics']; @@ -97,6 +99,37 @@ static public function displayWarningIfConfigFileNotWritable() } } + /** + * See http://dev.piwik.org/trac/ticket/4439#comment:8 and https://github.com/eaccelerator/eaccelerator/issues/12 + * + * Eaccelerator does not support closures and is known to be not comptabile with Piwik. Therefore we are disabling + * it automatically. At this point it looks like Eaccelerator is no longer under development and the bug has not + * been fixed within a year. + */ + public static function disableEacceleratorIfEnabled() + { + $isEacceleratorUsed = ini_get('eaccelerator.enable'); + + if (!empty($isEacceleratorUsed)) { + self::$isEacceleratorUsed = true; + + @ini_set('eaccelerator.enable', 0); + } + } + + private static function notifyIfEAcceleratorIsUsed() + { + if (self::$isEacceleratorUsed) { + $params = array('', ''); + $message = Piwik::translate('CoreAdminHome_EacceleratorNotCompatible', $params); + + $notification = new Notification($message); + $notification->context = Notification::CONTEXT_WARNING; + $notification->raw = true; + Notification\Manager::notify('ControllerAdmin_EacceleratorIsUsed', $notification); + } + } + /** * Assigns view properties that would be useful to views that render admin pages. * @@ -123,6 +156,7 @@ static public function displayWarningIfConfigFileNotWritable() static public function setBasicVariablesAdminView(View $view) { self::notifyWhenTrackingStatisticsDisabled(); + self::notifyIfEAcceleratorIsUsed(); $view->topMenu = MenuTop::getInstance()->getMenu(); $view->currentAdminMenuName = MenuAdmin::getInstance()->getCurrentAdminMenuName(); diff --git a/core/dispatch.php b/core/dispatch.php index 42e5a950f7b..a0a4e312db7 100644 --- a/core/dispatch.php +++ b/core/dispatch.php @@ -11,6 +11,9 @@ use Piwik\Error; use Piwik\ExceptionHandler; use Piwik\FrontController; +use \Piwik\Plugin\ControllerAdmin as PluginControllerAdmin; + +PluginControllerAdmin::disableEacceleratorIfEnabled(); if (!defined('PIWIK_ENABLE_ERROR_HANDLER') || PIWIK_ENABLE_ERROR_HANDLER) { require_once PIWIK_INCLUDE_PATH . '/core/Error.php'; diff --git a/lang/en.json b/lang/en.json index 1dbcea0f442..da10eeefa09 100644 --- a/lang/en.json +++ b/lang/en.json @@ -585,7 +585,8 @@ "PluginSettingsIntro": "Here you can change the settings for the following 3rd party plugins:", "PluginSettingsValueNotAllowed": "The value for field \"%s\" in plugin \"%s\" is not allowed", "PluginSettingChangeNotAllowed": "You are not allowed to change the value of the setting \"%s\" in plugin \"%s\"", - "PluginSettings": "Plugin settings" + "PluginSettings": "Plugin settings", + "EacceleratorNotCompatible": "You are using the PHP accelerator & optimizer eAccelerator which is known to be not compatible with Piwik. We have disabled eAccelerator therefore which might affect the performance of Piwik. Read the %srelated ticket%s for more information and how to fix this problem." }, "CoreHome": { "InjectedHostWarningIntro": "You are now accessing Piwik from %1$s, but Piwik has been configured to run at this address: %2$s.", diff --git a/piwik.php b/piwik.php index 8f9a68d6372..263b3b0de73 100644 --- a/piwik.php +++ b/piwik.php @@ -35,6 +35,11 @@ @ignore_user_abort(true); +require_once PIWIK_INCLUDE_PATH . '/core/Plugin/Controller.php'; +require_once PIWIK_INCLUDE_PATH . '/core/Plugin/ControllerAdmin.php'; + +\Piwik\Plugin\ControllerAdmin::disableEacceleratorIfEnabled(); + require_once PIWIK_INCLUDE_PATH . '/libs/upgradephp/upgrade.php'; require_once PIWIK_INCLUDE_PATH . '/core/testMinimumPhpVersion.php'; require_once PIWIK_INCLUDE_PATH . '/core/Singleton.php'; @@ -78,6 +83,7 @@ if (!defined('PIWIK_ENABLE_TRACKING') || PIWIK_ENABLE_TRACKING) { ob_start(); } + if ($GLOBALS['PIWIK_TRACKER_DEBUG'] === true) { require_once PIWIK_INCLUDE_PATH . '/core/Loader.php';