Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiosmosis <benaka@piwik.pro>2015-03-31 04:34:10 +0300
committerdiosmosis <benaka@piwik.pro>2015-03-31 04:34:10 +0300
commitb3f4f69ec2c0f7ae77461ffcfa57bc9073e290ae (patch)
tree67a4cc8feb08599fc36264a356e18f05e35094cc /plugins/CoreAdminHome/Tasks
parent873fb6f70ecb8d08b374353deb1c47ee2b23fadc (diff)
Refs #7560, if old list is found in DB for ArchivesToPurgeDistributedList, convert it to new list w/ only year-date to avoid error.
Diffstat (limited to 'plugins/CoreAdminHome/Tasks')
-rw-r--r--plugins/CoreAdminHome/Tasks/ArchivesToPurgeDistributedList.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/plugins/CoreAdminHome/Tasks/ArchivesToPurgeDistributedList.php b/plugins/CoreAdminHome/Tasks/ArchivesToPurgeDistributedList.php
index 6a30d6348a..ef5c7f533c 100644
--- a/plugins/CoreAdminHome/Tasks/ArchivesToPurgeDistributedList.php
+++ b/plugins/CoreAdminHome/Tasks/ArchivesToPurgeDistributedList.php
@@ -41,6 +41,13 @@ class ArchivesToPurgeDistributedList extends DistributedList
parent::setAll($yearMonths);
}
+ protected function getListOptionValue()
+ {
+ $result = parent::getListOptionValue();
+ $this->convertOldDistributedList($result);
+ return $result;
+ }
+
public function getAllAsDates()
{
$dates = array();
@@ -61,4 +68,20 @@ class ArchivesToPurgeDistributedList extends DistributedList
$yearMonth = $date->toString('Y_m');
$this->remove($yearMonth);
}
+
+ /**
+ * Before 2.12.0 Piwik stored this list as an array mapping year months to arrays of site IDs. If this is
+ * found in the DB, we convert the array to an array of year months to avoid errors and to make sure
+ * the correct tables are still purged.
+ */
+ private function convertOldDistributedList(&$yearMonths)
+ {
+ foreach ($yearMonths as $key => $value) {
+ if (preg_match("/^[0-9]{4}_[0-9]{2}$/", $key)) {
+ unset($yearMonths[$key]);
+
+ $yearMonths[] = $key;
+ }
+ }
+ }
} \ No newline at end of file