diff options
author | mattab <matthieu.aubry@gmail.com> | 2014-11-05 07:33:12 +0300 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2014-11-05 07:33:12 +0300 |
commit | f99d2f94c006f269abce9dbc34ab81693966be25 (patch) | |
tree | a2933309cb4e87107135e2597a22ed289750f906 /core/CronArchive.php | |
parent | 65ac550dc9af2a273b3ed478fd0d8d2e89f5ac2b (diff) |
refs #6508 started refactoring the code, created two new objects: ArchiveInvalidator to include the API CoreAdminHome.invalidateArchivedReports and InvalidatedReports to store the info of which report was invalidated
Diffstat (limited to 'core/CronArchive.php')
-rw-r--r-- | core/CronArchive.php | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/core/CronArchive.php b/core/CronArchive.php index a9987b7f9c..47bd0c98d8 100644 --- a/core/CronArchive.php +++ b/core/CronArchive.php @@ -13,7 +13,7 @@ use Piwik\ArchiveProcessor\Rules; use Piwik\CronArchive\FixedSiteIds; use Piwik\CronArchive\SharedSiteIds; use Piwik\Period\Factory as PeriodFactory; -use Piwik\Plugins\CoreAdminHome\API as APICoreAdminHome; +use Piwik\Plugins\CoreAdminHome\InvalidatedReports; use Piwik\Plugins\SitesManager\API as APISitesManager; /** @@ -605,7 +605,9 @@ class CronArchive // since it's now just about to being re-processed, makes sure another running cron archiving process // does not archive the same idSite if ($this->isOldReportInvalidatedForWebsite($idSite)) { - $this->removeWebsiteFromInvalidatedWebsites($idSite); + + $store = new InvalidatedReports(); + $store->removeWebsiteFromInvalidatedWebsites($idSite); } // when some data was purged from this website @@ -998,7 +1000,8 @@ class CronArchive private function updateIdSitesInvalidatedOldReports() { - $this->idSitesInvalidatedOldReports = APICoreAdminHome::getWebsiteIdsToInvalidate(); + $store = new InvalidatedReports(); + $this->idSitesInvalidatedOldReports = $store->getWebsiteIdsToInvalidate(); } /** @@ -1182,22 +1185,6 @@ class CronArchive return true; } - /** - * @param $idSite - */ - protected function removeWebsiteFromInvalidatedWebsites($idSite) - { - $websiteIdsInvalidated = APICoreAdminHome::getWebsiteIdsToInvalidate(); - - if (count($websiteIdsInvalidated)) { - $found = array_search($idSite, $websiteIdsInvalidated); - if ($found !== false) { - unset($websiteIdsInvalidated[$found]); - Option::set(APICoreAdminHome::OPTION_INVALIDATED_IDSITES, serialize($websiteIdsInvalidated)); - } - } - } - private function logFatalErrorUrlExpected() { $this->logFatalError("./console core:archive expects the argument 'url' to be set to your Piwik URL, for example: --url=http://example.org/piwik/ " |