diff options
Diffstat (limited to 'plugins/CoreAdminHome/Tasks.php')
-rw-r--r-- | plugins/CoreAdminHome/Tasks.php | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/plugins/CoreAdminHome/Tasks.php b/plugins/CoreAdminHome/Tasks.php index d633b9fd5d..8ee38a433a 100644 --- a/plugins/CoreAdminHome/Tasks.php +++ b/plugins/CoreAdminHome/Tasks.php @@ -15,6 +15,16 @@ use Piwik\Db; class Tasks extends \Piwik\Plugin\Tasks { + /** + * @var ArchivePurger + */ + private $archivePurger; + + public function __construct(ArchivePurger $archivePurger = null) + { + $this->archivePurger = $archivePurger ?: new ArchivePurger(); + } + public function schedule() { // general data purge on older archive tables, executed daily @@ -36,14 +46,14 @@ class Tasks extends \Piwik\Plugin\Tasks // Somehow we may have archive tables created with older dates, prevent exception from being thrown if ($year > 1990) { - ArchivePurger::purgeOutdatedArchives(Date::factory("$year-$month-15")); + $this->archivePurger->purgeOutdatedArchives(Date::factory("$year-$month-15")); } } } public function purgeInvalidatedArchives() { - ArchivePurger::purgeInvalidatedArchives(); + $this->archivePurger->purgeInvalidatedArchives(); } public function optimizeArchiveTable() |