From eea5d3ee67725609c3964504cf82d62a01cc60bd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bartosz=20Dziewo=C5=84ski?= Date: Tue, 24 Jul 2018 00:35:34 +0200 Subject: [PATCH] Remove incorrect timezone conversion from date parameters This affects at least Special:Log and Special:Contributions. The setTimezone() call does not actually change the offset used for database lookup, because getTimestamp() returns a Unix timestamp, which by definition does not include timezone information. We don't actually want to do anything with timezones here. Whether we like it or not, these date selectors have always used UTC dates. Follow-up to I8c2cd398d7c7ac68a8f46ee94cb9e7c6beed5694. Change-Id: Ia034017af5b37da3aa4889d5b7680c8be423126e --- includes/pager/RangeChronologicalPager.php | 2 -- includes/specials/SpecialLog.php | 2 -- 2 files changed, 4 deletions(-) diff --git a/includes/pager/RangeChronologicalPager.php b/includes/pager/RangeChronologicalPager.php index d3cb566823..bf36983530 100644 --- a/includes/pager/RangeChronologicalPager.php +++ b/includes/pager/RangeChronologicalPager.php @@ -45,14 +45,12 @@ abstract class RangeChronologicalPager extends ReverseChronologicalPager { try { if ( $startStamp !== '' ) { $startTimestamp = MWTimestamp::getInstance( $startStamp ); - $startTimestamp->setTimezone( $this->getConfig()->get( 'Localtimezone' ) ); $startOffset = $this->mDb->timestamp( $startTimestamp->getTimestamp() ); $this->rangeConds[] = $this->mIndexField . '>=' . $this->mDb->addQuotes( $startOffset ); } if ( $endStamp !== '' ) { $endTimestamp = MWTimestamp::getInstance( $endStamp ); - $endTimestamp->setTimezone( $this->getConfig()->get( 'Localtimezone' ) ); $endOffset = $this->mDb->timestamp( $endTimestamp->getTimestamp() ); $this->rangeConds[] = $this->mIndexField . '<=' . $this->mDb->addQuotes( $endOffset ); diff --git a/includes/specials/SpecialLog.php b/includes/specials/SpecialLog.php index 359eedea78..82bdd843e1 100644 --- a/includes/specials/SpecialLog.php +++ b/includes/specials/SpecialLog.php @@ -64,8 +64,6 @@ class SpecialLog extends SpecialPage { $dateString = $this->getRequest()->getVal( 'wpdate' ); if ( !empty( $dateString ) ) { $dateStamp = MWTimestamp::getInstance( $dateString . ' 00:00:00' ); - $dateStamp->setTimezone( $this->getConfig()->get( 'Localtimezone' ) ); - $opts->setValue( 'year', (int)$dateStamp->format( 'Y' ) ); $opts->setValue( 'month', (int)$dateStamp->format( 'm' ) ); $opts->setValue( 'day', (int)$dateStamp->format( 'd' ) ); -- 2.20.1