diff --git a/core/SettingsPiwik.php b/core/SettingsPiwik.php index ec915c5dee16300696efb6a50818516eab4e99b6..0d7dec95c4cfe6a5cc2b1e5b8798c6051561b316 100644 --- a/core/SettingsPiwik.php +++ b/core/SettingsPiwik.php @@ -169,10 +169,13 @@ class SettingsPiwik $key = 'piwikUrl'; $url = Option::get($key); + + $isPiwikCoreDispatching = defined('PIWIK_ENABLE_DISPATCH') && !PIWIK_ENABLE_DISPATCH; if (Common::isPhpCliMode() // in case archive.php is triggered with domain localhost || SettingsServer::isArchivePhpTriggered() - || defined('PIWIK_MODE_ARCHIVE') + // When someone else than core is dispatching this request then we return the URL as it is read only + || !$isPiwikCoreDispatching ) { return $url; } diff --git a/misc/cron/archive.php b/misc/cron/archive.php index dcc5fdaa4dc60e1ebe88f064127c35f6405eff1a..ff2fd5c48560d8006f0e95b471d8bd5055a879ca 100644 --- a/misc/cron/archive.php +++ b/misc/cron/archive.php @@ -24,9 +24,6 @@ if (!defined('PIWIK_USER_PATH')) { define('PIWIK_ENABLE_DISPATCH', false); define('PIWIK_ENABLE_ERROR_HANDLER', false); define('PIWIK_ENABLE_SESSION_START', false); -if(!defined('PIWIK_MODE_ARCHIVE')) { - define('PIWIK_MODE_ARCHIVE', true); -} require_once PIWIK_INCLUDE_PATH . "/index.php"; diff --git a/tests/PHPUnit/proxy/archive.php b/tests/PHPUnit/proxy/archive.php index 02ef4c611a65e1df086367619311e653022c5f68..6867dc796d737351b31ec5f94057bb53456441b2 100644 --- a/tests/PHPUnit/proxy/archive.php +++ b/tests/PHPUnit/proxy/archive.php @@ -1,5 +1,4 @@ <?php -define('PIWIK_MODE_ARCHIVE', true); define('PIWIK_ARCHIVE_NO_TRUNCATE', true); require realpath(dirname(__FILE__)) . "/includes.php";