Skip to content
Extraits de code Groupes Projets
Valider 2ca3e2a5 rédigé par mattab's avatar mattab
Parcourir les fichiers

Fix issue that when the General settings are disabled, then the settings...

Fix issue that when the General settings are disabled, then the settings should be read from the config file rather than the DB.
parent 9addbfd5
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -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.
......
......@@ -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'];
}
......
......@@ -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();
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter