Timestamp from Year/Month selector on forms should be wiki time
authorumherirrender <umherirrender_de.wp@web.de>
Sat, 18 Apr 2015 20:35:00 +0000 (22:35 +0200)
committerumherirrender <umherirrender_de.wp@web.de>
Fri, 15 May 2015 13:57:28 +0000 (15:57 +0200)
When searching for a year/month with the year/month selector on
Special:Contributions or action=history the given time should be treated
as wiki time and therefore needs adjust to UTC before search in the
Database.
This has no effect on wikis with UTC like enwiki, but for example on
dewiki with an offset from 1hour/2hour.

Change-Id: Iccd41d19a360827b9c80b66582ca0daa7ed7576c

includes/pager/ReverseChronologicalPager.php

index 4f8c438..ee6e26c 100644 (file)
@@ -113,6 +113,10 @@ abstract class ReverseChronologicalPager extends IndexPager {
                        $ymd = 20320101;
                }
 
-               $this->mOffset = $this->mDb->timestamp( "${ymd}000000" );
+               // Treat the given time in the wiki timezone and get a UTC timestamp for the database lookup
+               $timestamp = MWTimestamp::getInstance( "${ymd}000000" );
+               $timestamp->setTimeZone( $this->getConfig()->get( 'Localtimezone' ) );
+
+               $this->mOffset = $this->mDb->timestamp( $timestamp->getTimestamp() );
        }
 }