diff --git a/config/global.ini.php b/config/global.ini.php index cb72888c213fe1ab5b458296fd867db3aff0fa14..69544f98b842a727bf6951bc46a104a5aa897192 100644 --- a/config/global.ini.php +++ b/config/global.ini.php @@ -153,11 +153,12 @@ default_period = day ; Time in seconds after which an archive will be computed again. This setting is used only for today's statistics. ; Defaults to 10 seconds so that by default, Piwik provides real time reporting. ; This setting is overriden in the UI, under "General Settings". -; This is the default value used if the setting hasn't been overriden via the UI. +; This setting is only used if it hasn't been overriden via the UI yet, or if enable_general_settings_admin=0 time_before_today_archive_considered_outdated = 10 -; This setting is overriden in the UI, under "General Settings". The default value is to allow browsers -; to trigger the Piwik archiving process. +; This setting is overriden in the UI, under "General Settings". +; The default value is to allow browsers to trigger the Piwik archiving process. +; This setting is only used if it hasn't been overriden via the UI yet, or if enable_general_settings_admin=0 enable_browser_archiving_triggering = 1 ; By default Piwik runs OPTIMIZE TABLE SQL queries to free spaces after deleting some data. diff --git a/core/ArchiveProcessor/Rules.php b/core/ArchiveProcessor/Rules.php index 2c6925208f8ce223e95fafec688501acb9abd71f..b6a253f669bd78f36b113df8f826fe27f4c17072 100644 --- a/core/ArchiveProcessor/Rules.php +++ b/core/ArchiveProcessor/Rules.php @@ -15,6 +15,8 @@ use Piwik\Date; use Piwik\Log; use Piwik\Option; use Piwik\Piwik; +use Piwik\Plugins\CoreAdminHome\Controller; +use Piwik\Plugins\CoreAdminHome\CoreAdminHome; use Piwik\Segment; use Piwik\SettingsPiwik; use Piwik\SettingsServer; @@ -181,9 +183,13 @@ class Rules public static function getTodayArchiveTimeToLive() { - $timeToLive = Option::get(self::OPTION_TODAY_ARCHIVE_TTL); - if ($timeToLive !== false) { - return $timeToLive; + $uiSettingIsEnabled = Controller::isGeneralSettingsAdminEnabled(); + + if($uiSettingIsEnabled) { + $timeToLive = Option::get(self::OPTION_TODAY_ARCHIVE_TTL); + if ($timeToLive !== false) { + return $timeToLive; + } } return Config::getInstance()->General['time_before_today_archive_considered_outdated']; } @@ -223,9 +229,13 @@ class Rules public static function isBrowserTriggerEnabled() { - $browserArchivingEnabled = Option::get(self::OPTION_BROWSER_TRIGGER_ARCHIVING); - if ($browserArchivingEnabled !== false) { - return (bool)$browserArchivingEnabled; + $uiSettingIsEnabled = Controller::isGeneralSettingsAdminEnabled(); + + if($uiSettingIsEnabled) { + $browserArchivingEnabled = Option::get(self::OPTION_BROWSER_TRIGGER_ARCHIVING); + if ($browserArchivingEnabled !== false) { + return (bool)$browserArchivingEnabled; + } } return (bool)Config::getInstance()->General['enable_browser_archiving_triggering']; } diff --git a/plugins/CoreAdminHome/Controller.php b/plugins/CoreAdminHome/Controller.php index 74ec90762c47614d89560502ace8230bf672bf6b..0993f872c6cae9bf5c93f270d4407ee0d401361d 100644 --- a/plugins/CoreAdminHome/Controller.php +++ b/plugins/CoreAdminHome/Controller.php @@ -276,14 +276,14 @@ class Controller extends \Piwik\Plugin\ControllerAdmin return '0'; } - private function isGeneralSettingsAdminEnabled() + static public function isGeneralSettingsAdminEnabled() { return (bool) Config::getInstance()->General['enable_general_settings_admin']; } private function saveGeneralSettings() { - if(!$this->isGeneralSettingsAdminEnabled()) { + if(!self::isGeneralSettingsAdminEnabled()) { // General settings + Beta channel + SMTP settings is disabled return; } @@ -315,7 +315,7 @@ class Controller extends \Piwik\Plugin\ControllerAdmin private function handleGeneralSettingsAdmin($view) { // Whether to display or not the general settings (cron, beta, smtp) - $view->isGeneralSettingsAdminEnabled = $this->isGeneralSettingsAdminEnabled(); + $view->isGeneralSettingsAdminEnabled = self::isGeneralSettingsAdminEnabled(); $enableBrowserTriggerArchiving = Rules::isBrowserTriggerEnabled(); $todayArchiveTimeToLive = Rules::getTodayArchiveTimeToLive();