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:
authorm.kurzeja <m.kurzeja@clearcode.cc>2014-09-08 12:06:16 +0400
committerm.kurzeja <m.kurzeja@clearcode.cc>2014-09-08 12:06:16 +0400
commit395862b1e076c4072521291c6c702c2e2e94a7db (patch)
treea3e38da3b9a2c3a3bc43509b61b5bae2a5cfc7a8 /plugins/CoreAdminHome
parentc5eca515544f358e9ec09bd0c81e7cf2d4be97b1 (diff)
Added purging of invalidated archives in scheduled tasks
Diffstat (limited to 'plugins/CoreAdminHome')
-rw-r--r--plugins/CoreAdminHome/API.php6
-rw-r--r--plugins/CoreAdminHome/Tasks.php8
2 files changed, 12 insertions, 2 deletions
diff --git a/plugins/CoreAdminHome/API.php b/plugins/CoreAdminHome/API.php
index e18bd3f031..7abceb2430 100644
--- a/plugins/CoreAdminHome/API.php
+++ b/plugins/CoreAdminHome/API.php
@@ -10,6 +10,7 @@ namespace Piwik\Plugins\CoreAdminHome;
use Exception;
use Piwik\DataAccess\ArchiveTableCreator;
+use Piwik\DataAccess\ArchiveWriter;
use Piwik\Date;
use Piwik\Db;
use Piwik\Option;
@@ -152,13 +153,14 @@ class API extends \Piwik\Plugin\API
$sql = $bind = array();
$datesToDeleteInTable = array_unique($datesToDeleteInTable);
foreach ($datesToDeleteInTable as $dateToDelete) {
- $sql[] = '(date1 <= ? AND ? <= date2)';
+ $sql[] = '(date1 <= ? AND ? <= date2 AND name LIKE \'done%\')';
$bind[] = $dateToDelete;
$bind[] = $dateToDelete;
}
$sql = implode(" OR ", $sql);
- $query = "DELETE FROM $table " .
+ $query = "UPDATE $table " .
+ " SET value = " . ArchiveWriter::DONE_INVALIDATED .
" WHERE ( $sql ) " .
" AND idsite IN (" . implode(",", $idSites) . ")";
Db::query($query, $bind);
diff --git a/plugins/CoreAdminHome/Tasks.php b/plugins/CoreAdminHome/Tasks.php
index 5f08b4f096..3f82dba9e6 100644
--- a/plugins/CoreAdminHome/Tasks.php
+++ b/plugins/CoreAdminHome/Tasks.php
@@ -20,6 +20,9 @@ class Tasks extends \Piwik\Plugin\Tasks
// general data purge on older archive tables, executed daily
$this->daily('purgeOutdatedArchives', null, self::HIGH_PRIORITY);
+ // general data purge on invalidated archive records, executed daily
+ $this->daily('purgeInvalidatedArchives', null, self::HIGH_PRIORITY);
+
// lowest priority since tables should be optimized after they are modified
$this->daily('optimizeArchiveTable', null, self::LOWEST_PRIORITY);
}
@@ -38,6 +41,11 @@ class Tasks extends \Piwik\Plugin\Tasks
}
}
+ public function purgeInvalidatedArchives()
+ {
+ ArchivePurger::purgeInvalidatedArchives();
+ }
+
public function optimizeArchiveTable()
{
$archiveTables = ArchiveTableCreator::getTablesArchivesInstalled();