r106824 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106823‎ | r106824 | r106825 >
Date:17:40, 20 December 2011
Author:maxsem
Status:ok
Tags:
Comment:
Made todaysStart() honor local time zone
Modified paths:
  • /trunk/extensions/FeaturedFeeds/FeaturedFeeds.body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FeaturedFeeds/FeaturedFeeds.body.php
@@ -133,7 +133,15 @@
134134 public static function todaysStart() {
135135 static $time = false;
136136 if ( !$time ) {
137 - $time = wfTimestamp( TS_UNIX, substr( wfTimestamp( TS_MW ), 0, 8 ) . '000000' );
 137+ global $wgLocaltimezone;
 138+ if ( isset( $wgLocaltimezone ) ) {
 139+ $tz = new DateTimeZone( $wgLocaltimezone );
 140+ } else {
 141+ $tz = new DateTimeZone( date_default_timezone_get() );
 142+ }
 143+ $dt = new DateTime( 'now', $tz );
 144+ $dt->setTime( 0, 0, 0 );
 145+ $time = $dt->getTimestamp();
138146 }
139147 return $time;
140148 }

Status & tagging log