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:
authormattab <matthieu.aubry@gmail.com>2013-11-08 04:26:52 +0400
committermattab <matthieu.aubry@gmail.com>2013-11-08 04:26:52 +0400
commit25e7a79defefbe299746c7ddd30509625c17296f (patch)
treeda9f49f08e89ee941618ff19bbce0b6e4b228e26 /core/Archive.php
parent9bdf699c77db6e90c20fb4dfcd5b8bdfc9a3389f (diff)
Refs #4278 breaking down functions
Diffstat (limited to 'core/Archive.php')
-rw-r--r--core/Archive.php57
1 files changed, 34 insertions, 23 deletions
diff --git a/core/Archive.php b/core/Archive.php
index 084abb17dd..e0232f698f 100644
--- a/core/Archive.php
+++ b/core/Archive.php
@@ -537,7 +537,12 @@ class Archive
$doneFlags[$doneFlag] = true;
if (!isset($this->idarchives[$doneFlag])) {
- $archiveGroups[] = $this->getArchiveGroupOfPlugin($plugin);
+ $archiveGroup = $this->getArchiveGroupOfPlugin($plugin);
+
+ if($archiveGroup == self::ARCHIVE_ALL_PLUGINS_FLAG) {
+ $archiveGroup = reset($plugins);
+ }
+ $archiveGroups[] = $archiveGroup;
}
}
@@ -546,6 +551,7 @@ class Archive
// cache id archives for plugins we haven't processed yet
if (!empty($archiveGroups)) {
if (!Rules::isArchivingDisabledFor($this->params->getSegment(), $this->getPeriodLabel())) {
+
$this->cacheArchiveIdsAfterLaunching($archiveGroups, $plugins);
} else {
$this->cacheArchiveIdsWithoutLaunching($plugins);
@@ -583,8 +589,6 @@ class Archive
/* @var Period $period */
foreach ($this->params->getPeriods() as $period) {
- $periodStr = $period->getRangeString();
-
$twoDaysBeforePeriod = $period->getDateStart()->subDay(2);
$twoDaysAfterPeriod = $period->getDateEnd()->addDay(2);
@@ -607,26 +611,7 @@ class Archive
continue;
}
- $parameters = new ArchiveProcessor\Parameters($site, $period, $this->params->getSegment());
- $processing = new ArchiveProcessor\Loader($parameters);
-
- // process for each plugin as well
- foreach ($archiveGroups as $plugin) {
- if ($plugin == self::ARCHIVE_ALL_PLUGINS_FLAG) {
- $plugin = reset($plugins);
- }
-
- $doneFlag = $this->getDoneStringForPlugin($plugin);
- $this->initializeArchiveIdCache($doneFlag);
-
- $parameters->setRequestedPlugin($plugin);
- $idArchive = $processing->preProcessArchive();
-
- $visits = $processing->getNumberOfVisits();
- if ($visits > 0) {
- $this->idarchives[$doneFlag][$periodStr][] = $idArchive;
- }
- }
+ $this->launchArchiveProcessor($archiveGroups, $site, $period);
}
}
}
@@ -789,4 +774,30 @@ class Archive
}
return $plugin;
}
+
+ /**getNumberOfVisits
+ * @param $archiveGroups
+ * @param $site
+ * @param $period
+ */
+ private function launchArchiveProcessor(array $archiveGroups, Site $site, Period $period)
+ {
+ $parameters = new ArchiveProcessor\Parameters($site, $period, $this->params->getSegment());
+ $processing = new ArchiveProcessor\Loader($parameters);
+
+ $periodString = $period->getRangeString();
+
+ // process for each plugin as well
+ foreach ($archiveGroups as $plugin) {
+ $doneFlag = $this->getDoneStringForPlugin($plugin);
+ $this->initializeArchiveIdCache($doneFlag);
+
+ $parameters->setRequestedPlugin($plugin);
+ $idArchive = $processing->prepareArchiveId();
+
+ if($idArchive) {
+ $this->idarchives[$doneFlag][$periodString][] = $idArchive;
+ }
+ }
+ }
} \ No newline at end of file