From 4823afe878f87bafb2df55c70db3bcab49fe3fb6 Mon Sep 17 00:00:00 2001 From: Thomas Steur Date: Sun, 21 Dec 2014 23:59:53 +0100 Subject: we do not want to use the API here since it needs admin access --- core/Archive.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'core/Archive.php') diff --git a/core/Archive.php b/core/Archive.php index 76a619f0bb..208d6dfdce 100644 --- a/core/Archive.php +++ b/core/Archive.php @@ -13,7 +13,6 @@ use Piwik\ArchiveProcessor\Rules; use Piwik\DataAccess\ArchiveInvalidator; use Piwik\DataAccess\ArchiveSelector; use Piwik\Period\Factory as PeriodFactory; -use Piwik\Plugins\CoreAdminHome\API as CoreAdminHomeApi; /** * The **Archive** class is used to query cached analytics statistics @@ -505,12 +504,21 @@ class Archive $sitesPerDays = $invalidator->getRememberedArchivedReportsThatShouldBeInvalidated(); foreach ($sitesPerDays as $date => $siteIds) { - if (!empty($siteIds)) { + if (empty($siteIds)) { + continue; + } + + try { // an advanced version would only invalidate siteIds for $this->params->getIdSites() but would make // everything way more complex eg the cache above and which siteIds we pass here... - CoreAdminHomeApi::getInstance()->invalidateArchivedReports($siteIds, $date); + $invalidator->markArchivesAsInvalidated($siteIds, $date, false); + } catch (\Exception $e) { + Site::clearCache(); + throw $e; } } + + Site::clearCache(); } /** -- cgit v1.2.3