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
diff options
context:
space:
mode:
Diffstat (limited to 'core/ArchiveProcessor/Rules.php')
-rw-r--r--core/ArchiveProcessor/Rules.php32
1 files changed, 25 insertions, 7 deletions
diff --git a/core/ArchiveProcessor/Rules.php b/core/ArchiveProcessor/Rules.php
index b6a253f669..6ac43ddc06 100644
--- a/core/ArchiveProcessor/Rules.php
+++ b/core/ArchiveProcessor/Rules.php
@@ -50,21 +50,21 @@ class Rules
* @param string $plugin
* @return string
*/
- public static function getDoneStringFlagFor($segment, $periodLabel, $plugin)
+ public static function getDoneStringFlagFor(array $idSites, $segment, $periodLabel, $plugin)
{
- if (!self::shouldProcessReportsAllPlugins($segment, $periodLabel)) {
+ if (!self::shouldProcessReportsAllPlugins($idSites, $segment, $periodLabel)) {
return self::getDoneFlagArchiveContainsOnePlugin($segment, $plugin);
}
return self::getDoneFlagArchiveContainsAllPlugins($segment);
}
- public static function shouldProcessReportsAllPlugins(Segment $segment, $periodLabel)
+ public static function shouldProcessReportsAllPlugins(array $idSites, Segment $segment, $periodLabel)
{
if ($segment->isEmpty() && $periodLabel != 'range') {
return true;
}
- $segmentsToProcess = SettingsPiwik::getKnownSegmentsToArchive();
+ $segmentsToProcess = self::getSegmentsToProcess($idSites);
if (!empty($segmentsToProcess)) {
// If the requested segment is one of the segments to pre-process
// we ensure that any call to the API will trigger archiving of all reports for this segment
@@ -76,6 +76,23 @@ class Rules
return false;
}
+ /**
+ * @param $idSites
+ * @return array
+ */
+ private static function getSegmentsToProcess($idSites)
+ {
+ $knownSegmentsToArchiveAllSites = SettingsPiwik::getKnownSegmentsToArchive();
+
+ $segmentsToProcess = $knownSegmentsToArchiveAllSites;
+ foreach ($idSites as $idSite) {
+ $segmentForThisWebsite = SettingsPiwik::getKnownSegmentsToArchiveForSite($idSite);
+ $segmentsToProcess = array_merge($segmentsToProcess, $segmentForThisWebsite);
+ }
+ $segmentsToProcess = array_unique($segmentsToProcess);
+ return $segmentsToProcess;
+ }
+
private static function getDoneFlagArchiveContainsOnePlugin(Segment $segment, $plugin)
{
return 'done' . $segment->getHash() . '.' . $plugin;
@@ -155,7 +172,8 @@ class Rules
$now = time();
$minimumArchiveTime = $now - Rules::getTodayArchiveTimeToLive();
- $isArchivingDisabled = Rules::isArchivingDisabledFor($segment, $period->getLabel());
+ $idSites = array($site->getId());
+ $isArchivingDisabled = Rules::isArchivingDisabledFor($idSites, $segment, $period->getLabel());
if ($isArchivingDisabled) {
if ($period->getNumberOfSubperiods() == 0
&& $dateStart->getTimestamp() <= $now
@@ -194,12 +212,12 @@ class Rules
return Config::getInstance()->General['time_before_today_archive_considered_outdated'];
}
- public static function isArchivingDisabledFor(Segment $segment, $periodLabel)
+ public static function isArchivingDisabledFor(array $idSites, Segment $segment, $periodLabel)
{
if ($periodLabel == 'range') {
return false;
}
- $processOneReportOnly = !self::shouldProcessReportsAllPlugins($segment, $periodLabel);
+ $processOneReportOnly = !self::shouldProcessReportsAllPlugins($idSites, $segment, $periodLabel);
$isArchivingDisabled = !self::isRequestAuthorizedToArchive();
if ($processOneReportOnly) {