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:
-rw-r--r--core/DataAccess/Model.php6
-rw-r--r--tests/PHPUnit/Integration/DataAccess/ArchiveInvalidatorTest.php14
2 files changed, 17 insertions, 3 deletions
diff --git a/core/DataAccess/Model.php b/core/DataAccess/Model.php
index d6d2de787e..0742709197 100644
--- a/core/DataAccess/Model.php
+++ b/core/DataAccess/Model.php
@@ -755,7 +755,7 @@ class Model
$table = Common::prefixTable('archive_invalidations');
$sql = "DELETE FROM `$table` WHERE $idSitesClause `name` LIKE ?";
- Db::query($sql, ['done.' . str_replace('_', "\\_", $start) . '%']);
+ Db::query($sql, ['done%.' . str_replace('_', "\\_", $start)]);
}
public function removeInvalidations($idSite, $plugin, $report)
@@ -763,9 +763,9 @@ class Model
$idSitesClause = $this->getRemoveInvalidationsIdSitesClause($idSite);
$table = Common::prefixTable('archive_invalidations');
- $sql = "DELETE FROM `$table` WHERE $idSitesClause `name` = ? AND report = ?";
+ $sql = "DELETE FROM `$table` WHERE $idSitesClause `name` LIKE ? AND report = ?";
- Db::query($sql, ['done.' . $plugin, $report]);
+ Db::query($sql, ['done%.' . str_replace('_', "\\_", $plugin), $report]);
}
public function isArchiveAlreadyInProgress($invalidatedArchive)
diff --git a/tests/PHPUnit/Integration/DataAccess/ArchiveInvalidatorTest.php b/tests/PHPUnit/Integration/DataAccess/ArchiveInvalidatorTest.php
index 7f52f1aa71..21f92cb9f1 100644
--- a/tests/PHPUnit/Integration/DataAccess/ArchiveInvalidatorTest.php
+++ b/tests/PHPUnit/Integration/DataAccess/ArchiveInvalidatorTest.php
@@ -184,7 +184,9 @@ class ArchiveInvalidatorTest extends IntegrationTestCase
$this->insertInvalidations([
['name' => 'done.MyPlugin', 'idsite' => 1, 'date1' => '2012-03-04', 'date2' => '2015-03-04', 'period' => 1, 'report' => 'myReport'],
['name' => 'done.MyPlugin', 'idsite' => 1, 'date1' => '2012-03-04', 'date2' => '2015-03-04', 'period' => 1, 'report' => null],
+ ['name' => 'doneSEGMENTHASH.MyPlugin', 'idsite' => 1, 'date1' => '2012-03-04', 'date2' => '2015-03-04', 'period' => 1, 'report' => null],
['name' => 'done.MyOtherPlugin', 'idsite' => 1, 'date1' => '2012-03-04', 'date2' => '2015-05-05', 'period' => 1, 'report' => ''],
+ ['name' => 'doneSEGMENTHASH.MyOtherPlugin', 'idsite' => 1, 'date1' => '2012-03-04', 'date2' => '2015-05-05', 'period' => 1, 'report' => ''],
['name' => 'done', 'idsite' => 1, 'date1' => '2012-03-04', 'date2' => '2015-05-05', 'period' => 1, 'report' => ''],
['name' => 'done.MyPlugin', 'idsite' => 1, 'date1' => '2012-03-04', 'date2' => '2015-03-04', 'period' => 1, 'report' => 'myOtherReport'],
]);
@@ -194,6 +196,7 @@ class ArchiveInvalidatorTest extends IntegrationTestCase
$invalidations = $this->getInvalidatedArchiveTableEntries();
$expectedInvalidations = [
['idarchive' => null, 'idsite' => 1, 'date1' => '2012-03-04', 'date2' => '2015-05-05', 'period' => 1, 'name' => 'done.MyOtherPlugin', 'report' => null],
+ ['idarchive' => null, 'idsite' => 1, 'date1' => '2012-03-04', 'date2' => '2015-05-05', 'period' => 1, 'name' => 'doneSEGMENTHASH.MyOtherPlugin', 'report' => null],
['idarchive' => null, 'idsite' => 1, 'date1' => '2012-03-04', 'date2' => '2015-05-05', 'period' => 1, 'name' => 'done', 'report' => null],
];
@@ -205,6 +208,8 @@ class ArchiveInvalidatorTest extends IntegrationTestCase
$this->insertInvalidations([
['name' => 'done.MyPlugin', 'idsite' => 1, 'date1' => '2012-03-04', 'date2' => '2015-03-04', 'period' => 1, 'report' => 'myReport'],
['name' => 'done.MyPlugin', 'idsite' => 1, 'date1' => '2012-03-04', 'date2' => '2015-03-04', 'period' => 1, 'report' => null],
+ ['name' => 'doneSEGMENTHASH.MyPlugin', 'idsite' => 1, 'date1' => '2012-03-04', 'date2' => '2015-03-04', 'period' => 1, 'report' => null],
+ ['name' => 'doneSEGMENTHASH.MyPlugin', 'idsite' => 1, 'date1' => '2012-03-04', 'date2' => '2015-03-04', 'period' => 1, 'report' => 'myReport'],
['name' => 'done.MyOtherPlugin', 'idsite' => 1, 'date1' => '2012-03-04', 'date2' => '2015-05-05', 'period' => 1, 'report' => ''],
['name' => 'done', 'idsite' => 1, 'date1' => '2012-03-04', 'date2' => '2015-05-05', 'period' => 1, 'report' => ''],
['name' => 'done.MyPlugin', 'idsite' => 1, 'date1' => '2012-03-04', 'date2' => '2015-03-04', 'period' => 1, 'report' => 'myOtherReport'],
@@ -227,6 +232,15 @@ class ArchiveInvalidatorTest extends IntegrationTestCase
'idarchive' => NULL,
'idsite' => '1',
'date1' => '2012-03-04',
+ 'date2' => '2015-03-04',
+ 'period' => '1',
+ 'name' => 'doneSEGMENTHASH.MyPlugin',
+ 'report' => NULL,
+ ],
+ [
+ 'idarchive' => NULL,
+ 'idsite' => '1',
+ 'date1' => '2012-03-04',
'date2' => '2015-05-05',
'period' => '1',
'name' => 'done.MyOtherPlugin',