diff options
author | Matthieu Aubry <matt@piwik.org> | 2016-04-01 04:00:03 +0300 |
---|---|---|
committer | Matthieu Aubry <matt@piwik.org> | 2016-04-01 04:00:03 +0300 |
commit | 193d0e93ad211802ea3293b132e096f80d20bb1d (patch) | |
tree | c14e69ebc918b46bcb742fed1e08c6cee77639d9 /core | |
parent | f5b12ea37556cd0f0da472550652f7314dc83145 (diff) | |
parent | 45f2a470348c03f67c14e401bc54117823600ddd (diff) |
Merge pull request #9992 from piwik/archiving_tweaks
Improve all websites dashboard performance when using range date
Diffstat (limited to 'core')
-rw-r--r-- | core/Archive.php | 12 | ||||
-rw-r--r-- | core/ArchiveProcessor/Rules.php | 20 |
2 files changed, 18 insertions, 14 deletions
diff --git a/core/Archive.php b/core/Archive.php index 2efe230318..8bddda0922 100644 --- a/core/Archive.php +++ b/core/Archive.php @@ -646,7 +646,7 @@ class Archive $doneFlags = array(); $archiveGroups = array(); foreach ($plugins as $plugin) { - $doneFlag = $this->getDoneStringForPlugin($plugin); + $doneFlag = $this->getDoneStringForPlugin($plugin, $this->params->getIdSites()); $doneFlags[$doneFlag] = true; if (!isset($this->idarchives[$doneFlag])) { @@ -731,7 +731,7 @@ class Archive // initialize archive ID cache for each report foreach ($plugins as $plugin) { - $doneFlag = $this->getDoneStringForPlugin($plugin); + $doneFlag = $this->getDoneStringForPlugin($plugin, $this->params->getIdSites()); $this->initializeArchiveIdCache($doneFlag); } @@ -749,10 +749,10 @@ class Archive * @param string $plugin * @return string */ - private function getDoneStringForPlugin($plugin) + private function getDoneStringForPlugin($plugin, $idSites) { return Rules::getDoneStringFlagFor( - $this->params->getIdSites(), + $idSites, $this->params->getSegment(), $this->getPeriodLabel(), $plugin @@ -893,9 +893,11 @@ class Archive $periodString = $period->getRangeString(); + $idSites = array($site->getId()); + // process for each plugin as well foreach ($archiveGroups as $plugin) { - $doneFlag = $this->getDoneStringForPlugin($plugin); + $doneFlag = $this->getDoneStringForPlugin($plugin, $idSites); $this->initializeArchiveIdCache($doneFlag); $idArchive = $archiveLoader->prepareArchive($plugin); diff --git a/core/ArchiveProcessor/Rules.php b/core/ArchiveProcessor/Rules.php index 0ec92f7590..7f37b3250c 100644 --- a/core/ArchiveProcessor/Rules.php +++ b/core/ArchiveProcessor/Rules.php @@ -172,20 +172,21 @@ class Rules || $generalConfig['archiving_range_force_on_browser_request'] != false ) { return false; - } else { - Log::debug("Not forcing archiving for range period."); } + + Log::debug("Not forcing archiving for range period."); + $processOneReportOnly = false; + + } else { + $processOneReportOnly = !self::shouldProcessReportsAllPlugins($idSites, $segment, $periodLabel); } - $processOneReportOnly = !self::shouldProcessReportsAllPlugins($idSites, $segment, $periodLabel); - $isArchivingDisabled = !self::isRequestAuthorizedToArchive() || self::$archivingDisabledByTests; + $isArchivingEnabled = self::isRequestAuthorizedToArchive() && !self::$archivingDisabledByTests; - if ($processOneReportOnly - && $periodLabel != 'range' - ) { + if ($processOneReportOnly) { // When there is a segment, we disable archiving when browser_archiving_disabled_enforce applies if (!$segment->isEmpty() - && $isArchivingDisabled + && !$isArchivingEnabled && $generalConfig['browser_archiving_disabled_enforce'] && !SettingsServer::isArchivePhpTriggered() // Only applies when we are not running core:archive command ) { @@ -196,7 +197,8 @@ class Rules // Always allow processing one report return false; } - return $isArchivingDisabled; + + return !$isArchivingEnabled; } public static function isRequestAuthorizedToArchive() |