diff options
author | diosmosis <benaka@piwik.pro> | 2015-03-06 06:47:08 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-03-06 06:47:08 +0300 |
commit | 746b599f03d93ad82a1a270f610f1cf15787a949 (patch) | |
tree | 2ec8f3705cef57302276edc8a50d0d967c3ea9d8 /plugins | |
parent | ca1a5c3c365f3b1e7c3529e0568a9cca60ec754c (diff) |
Refs #7811, do not purge custom ranges in same method as outdated archive purging. Move to a second method in Archive\Purger.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/CoreAdminHome/Commands/PurgeOldArchiveData.php | 13 | ||||
-rw-r--r-- | plugins/CoreAdminHome/Tasks.php | 5 |
2 files changed, 17 insertions, 1 deletions
diff --git a/plugins/CoreAdminHome/Commands/PurgeOldArchiveData.php b/plugins/CoreAdminHome/Commands/PurgeOldArchiveData.php index c8a358e721..8c88a7e312 100644 --- a/plugins/CoreAdminHome/Commands/PurgeOldArchiveData.php +++ b/plugins/CoreAdminHome/Commands/PurgeOldArchiveData.php @@ -56,6 +56,7 @@ class PurgeOldArchiveData extends ConsoleCommand array(self::getToday()->toString())); $this->addOption('exclude-outdated', null, InputOption::VALUE_NONE, "Do not purge outdated archive data."); $this->addOption('exclude-invalidated', null, InputOption::VALUE_NONE, "Do not purge invalidated archive data."); + $this->addOption('exclude-ranges', null, InputOption::VALUE_NONE, "Do not purge custom ranges."); $this->addOption('skip-optimize-tables', null, InputOption::VALUE_NONE, "Do not run OPTIMIZE TABLES query on affected archive tables."); $this->setHelp("By default old and invalidated archives are purged. Custom ranges are also purged with outdated archives.\n\n" . "Note: archive purging is done during scheduled task execution, so under normal circumstances, you should not need to " @@ -93,6 +94,18 @@ class PurgeOldArchiveData extends ConsoleCommand } } + $excludeCustomRanges = $input->getOption('exclude-ranges'); + if ($excludeCustomRanges) { + $output->writeln("Skipping purge custom range archives."); + } else { + foreach ($dates as $date) { + $message = sprintf("Purging custom range archives for %s...", $date->toString('Y_m')); + $this->performTimedPurging($output, $message, function () use ($date, $archivePurger) { + $archivePurger->purgeArchivesWithPeriodRange($date); + }); + } + } + $skipOptimizeTables = $input->getOption('skip-optimize-tables'); if ($skipOptimizeTables) { $output->writeln("Skipping OPTIMIZE TABLES."); diff --git a/plugins/CoreAdminHome/Tasks.php b/plugins/CoreAdminHome/Tasks.php index 07398a83e3..ae28788d1d 100644 --- a/plugins/CoreAdminHome/Tasks.php +++ b/plugins/CoreAdminHome/Tasks.php @@ -58,7 +58,10 @@ class Tasks extends \Piwik\Plugin\Tasks // Somehow we may have archive tables created with older dates, prevent exception from being thrown if ($year > 1990) { - $this->archivePurger->purgeOutdatedArchives(Date::factory("$year-$month-15")); + $dateObj = Date::factory("$year-$month-15"); + + $this->archivePurger->purgeOutdatedArchives($dateObj); + $this->archivePurger->purgeArchivesWithPeriodRange($dateObj); } } } |