diff options
author | Kate Butler <kate@innocraft.com> | 2019-04-16 04:12:05 +0300 |
---|---|---|
committer | Thomas Steur <tsteur@users.noreply.github.com> | 2019-04-16 04:12:05 +0300 |
commit | 6a1442fa320cdeea1b96a08c00f622d47bedc354 (patch) | |
tree | 35c30fd022c361367215a1e68c2ef00cb1224d2b /core | |
parent | fc8b08c3f5152a2e0785a2ccbb1fffc5d209c0df (diff) |
Fix archive invalidation timezone issue in tracker (#14318)
* Fix timezone bug in PHP tracker archive invalidation
* Reset timezone after each unit test
* Fix timezone issue in unit test
* More elegant method for getting midnight in UTC+5
Diffstat (limited to 'core')
-rw-r--r-- | core/Tracker/Visit.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/Tracker/Visit.php b/core/Tracker/Visit.php index f768ed6190..25ff938562 100644 --- a/core/Tracker/Visit.php +++ b/core/Tracker/Visit.php @@ -557,7 +557,11 @@ class Visit implements VisitInterface $date = Date::factory((int)$time, $timezone); - if (!$date->isToday()) { // we don't have to handle in case date is in future as it is not allowed by tracker + // $date->isToday() is buggy when server and website timezones don't match - so we'll do our own checking + $startOfToday = Date::factoryInTimezone('today', $timezone); + $isToday = $date->toString('Y-m-d') === $startOfToday->toString('Y-m-d'); + + if (!$isToday) { // we don't have to handle in case date is in future as it is not allowed by tracker $this->invalidator->rememberToInvalidateArchivedReportsLater($idSite, $date); } } |