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
path: root/core
diff options
context:
space:
mode:
authorBen Burgess <88810029+bx80@users.noreply.github.com>2022-03-08 23:21:06 +0300
committerGitHub <noreply@github.com>2022-03-08 23:21:06 +0300
commit680db1156be27769709bf9a6e7f67636e7cfb8dc (patch)
tree63f614e3dc1e81d015415bd047dae4d9b0f9187c /core
parent05397a2a7a3c0cb5ae73e64ca2f5f8cc0ff7cbdc (diff)
Prevent archiving of data for time periods that start in the future (#18790)
* Prevent archiving data later than today instead of today + 2days * Added archive test to check that periods that start in the future are not archived * Allow for local time being a day ahead of UTC when skipping archive ranges * Added test for website with local time in the previous day from the current UTC time
Diffstat (limited to 'core')
-rw-r--r--core/Archive.php10
1 files changed, 5 insertions, 5 deletions
diff --git a/core/Archive.php b/core/Archive.php
index 26abc2ce0a..09227df4d8 100644
--- a/core/Archive.php
+++ b/core/Archive.php
@@ -610,10 +610,7 @@ class Archive implements ArchiveQuery
*/
private function cacheArchiveIdsAfterLaunching($archiveGroups, $plugins)
{
- $today = Date::today();
-
foreach ($this->params->getPeriods() as $period) {
- $twoDaysBeforePeriod = $period->getDateStart()->subDay(2);
$twoDaysAfterPeriod = $period->getDateEnd()->addDay(2);
foreach ($this->params->getIdSites() as $idSite) {
@@ -635,8 +632,11 @@ class Archive implements ArchiveQuery
continue;
}
- // if the starting date is in the future we know there is no visiidsite = ?t
- if ($twoDaysBeforePeriod->isLater($today)) {
+ // Allow for site timezone, local time may have started a new day ahead of UTC
+ $today = \Piwik\Date::factory('now', $site->getTimezone());
+
+ // if the starting date is in the future we know there are no visits
+ if ($period->getDateStart()->isLater($today)) {
Log::debug("Archive site %s, %s (%s) skipped, archive is after today.",
$idSite, $period->getLabel(), $period->getPrettyString());
continue;