diff options
author | Matthieu Napoli <matthieu@mnapoli.fr> | 2015-04-15 09:08:40 +0300 |
---|---|---|
committer | Matthieu Napoli <matthieu@mnapoli.fr> | 2015-04-15 09:08:40 +0300 |
commit | dd739fd86b0f303548180b92e9fcf1508b15d19c (patch) | |
tree | 7c035817b980d0f796c33f37080cae0efe525751 /core/CronArchive | |
parent | 1f40a90e49859038c9a6c6b3f7edb151f9bea537 (diff) |
#7614 Archiving with `--force-all-websites` now shares the site list
That allows to run a second archive process which will reuse the same (shared) site list.
Diffstat (limited to 'core/CronArchive')
-rw-r--r-- | core/CronArchive/SharedSiteIds.php | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/core/CronArchive/SharedSiteIds.php b/core/CronArchive/SharedSiteIds.php index 50f95ea2dd..facc331a6d 100644 --- a/core/CronArchive/SharedSiteIds.php +++ b/core/CronArchive/SharedSiteIds.php @@ -18,12 +18,22 @@ use Piwik\Option; */ class SharedSiteIds { + const OPTION_DEFAULT = 'SharedSiteIdsToArchive'; + const OPTION_ALL_WEBSITES = 'SharedSiteIdsToArchive_AllWebsites'; + + /** + * @var string + */ + private $optionName; + private $siteIds = array(); private $currentSiteId; private $done = false; - public function __construct($websiteIds) + public function __construct($websiteIds, $optionName = self::OPTION_DEFAULT) { + $this->optionName = $optionName; + if (empty($websiteIds)) { $websiteIds = array(); } @@ -86,16 +96,16 @@ class SharedSiteIds public function setSiteIdsToArchive($siteIds) { if (!empty($siteIds)) { - Option::set('SharedSiteIdsToArchive', implode(',', $siteIds)); + Option::set($this->optionName, implode(',', $siteIds)); } else { - Option::delete('SharedSiteIdsToArchive'); + Option::delete($this->optionName); } } public function getAllSiteIdsToArchive() { - Option::clearCachedOption('SharedSiteIdsToArchive'); - $siteIdsToArchive = Option::get('SharedSiteIdsToArchive'); + Option::clearCachedOption($this->optionName); + $siteIdsToArchive = Option::get($this->optionName); if (empty($siteIdsToArchive)) { return array(); |