diff options
author | diosmosis <benaka@piwik.pro> | 2015-10-08 17:03:59 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-10-12 21:05:37 +0300 |
commit | a952cc5a9765da33a7a1f3f575b90d76fbaf5a38 (patch) | |
tree | 64390e0b4d585fb5512b0e2d1dd0f9e98a1ec584 /core/DataAccess | |
parent | c186252bf9a30a54c15330f0f4c88c1a033e7f25 (diff) |
Rename InvalidationResultInfo to InvalidationResult and remove Period::getAllParentPeriods and replace its use in ArchiveInvalidator w/ some small SQL changes.
Diffstat (limited to 'core/DataAccess')
-rw-r--r-- | core/DataAccess/Model.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/core/DataAccess/Model.php b/core/DataAccess/Model.php index e8ec27c7de..4213cd2039 100644 --- a/core/DataAccess/Model.php +++ b/core/DataAccess/Model.php @@ -122,10 +122,16 @@ class Model } $dateConditionsSql = implode(" OR ", $dateConditions); - if (empty($periodType)) { // remove all periods + if (empty($periodType) + || $periodType == Period\Day::PERIOD_ID + ) { + // invalidate all periods if no period supplied or period is day $periodConditions[] = "($dateConditionsSql)"; + } else if ($periodType == Period\Range::PERIOD_ID) { + $periodConditions[] = "(period = " . Period\Range::PERIOD_ID . " AND ($dateConditionsSql))"; } else { - $periodConditions[] = "(period = " . (int)$periodType . " AND ($dateConditionsSql))"; + // for non-day periods, invalidate greater periods, but not range periods + $periodConditions[] = "(period >= " . (int)$periodType . " AND period < " . Period\Range::PERIOD_ID . " AND ($dateConditionsSql))"; } } |