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
path: root/core
diff options
context:
space:
mode:
authorMatthieu Napoli <matthieu@mnapoli.fr>2014-12-22 05:32:45 +0300
committerMatthieu Napoli <matthieu@mnapoli.fr>2014-12-22 05:36:48 +0300
commitb4af652dd9284f5565ba658389840a47dac48211 (patch)
tree229f6e65e3112cd9f7ef6741666a7299e463c081 /core
parent939d1c1be832472204aa000f003d1eba20a1edbb (diff)
Moved common bootstrap code in a `core/bootstrap.php` file
This file is not in a class because it needs to be compatible with PHP 4.
Diffstat (limited to 'core')
-rw-r--r--core/Plugin/ControllerAdmin.php23
-rw-r--r--core/bootstrap.php38
-rw-r--r--core/dispatch.php3
3 files changed, 40 insertions, 24 deletions
diff --git a/core/Plugin/ControllerAdmin.php b/core/Plugin/ControllerAdmin.php
index 008cb4d2f4..23184caa8f 100644
--- a/core/Plugin/ControllerAdmin.php
+++ b/core/Plugin/ControllerAdmin.php
@@ -29,8 +29,6 @@ use Piwik\View;
*/
abstract class ControllerAdmin extends Controller
{
- private static $isEacceleratorUsed = false;
-
private static function notifyWhenTrackingStatisticsDisabled()
{
$statsEnabled = PiwikConfig::getInstance()->Tracker['record_statistics'];
@@ -105,27 +103,10 @@ abstract class ControllerAdmin extends Controller
}
}
- /**
- * See https://github.com/piwik/piwik/issues/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) {
+ $isEacceleratorUsed = ini_get('eaccelerator.enable');
+ if (empty($isEacceleratorUsed)) {
return;
}
$message = sprintf("You are using the PHP accelerator & optimizer eAccelerator which is known to be not compatible with Piwik.
diff --git a/core/bootstrap.php b/core/bootstrap.php
new file mode 100644
index 0000000000..546625b8c6
--- /dev/null
+++ b/core/bootstrap.php
@@ -0,0 +1,38 @@
+<?php
+/**
+ * Bootstraps the Piwik application.
+ */
+
+if (!defined('PIWIK_USER_PATH')) {
+ define('PIWIK_USER_PATH', PIWIK_DOCUMENT_ROOT);
+}
+
+error_reporting(E_ALL | E_NOTICE);
+@ini_set('display_errors', defined('PIWIK_DISPLAY_ERRORS') ? PIWIK_DISPLAY_ERRORS : @ini_get('display_errors'));
+@ini_set('xdebug.show_exception_trace', 0);
+@ini_set('magic_quotes_runtime', 0);
+
+// NOTE: the code above must be PHP4 compatible
+require_once PIWIK_INCLUDE_PATH . '/core/testMinimumPhpVersion.php';
+
+session_cache_limiter('nocache');
+@date_default_timezone_set('UTC');
+
+disableEaccelerator();
+
+require_once PIWIK_INCLUDE_PATH . '/libs/upgradephp/upgrade.php';
+
+/**
+ * See https://github.com/piwik/piwik/issues/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.
+ */
+function disableEaccelerator()
+{
+ $isEacceleratorUsed = ini_get('eaccelerator.enable');
+ if (!empty($isEacceleratorUsed)) {
+ @ini_set('eaccelerator.enable', 0);
+ }
+}
diff --git a/core/dispatch.php b/core/dispatch.php
index 1359dd8ee5..c63f2f76b4 100644
--- a/core/dispatch.php
+++ b/core/dispatch.php
@@ -11,9 +11,6 @@
use Piwik\ErrorHandler;
use Piwik\ExceptionHandler;
use Piwik\FrontController;
-use Piwik\Plugin\ControllerAdmin as PluginControllerAdmin;
-
-PluginControllerAdmin::disableEacceleratorIfEnabled();
if (!defined('PIWIK_ENABLE_ERROR_HANDLER') || PIWIK_ENABLE_ERROR_HANDLER) {
ErrorHandler::registerErrorHandler();