Last modified: 2008-02-09 20:41:40 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 12815 - $wgLocaltimezone half ignored in signatures
$wgLocaltimezone half ignored in signatures
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.12.x
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-01-28 05:29 UTC by Charlie Huggard
Modified: 2008-02-09 20:41 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Charlie Huggard 2008-01-28 05:29:50 UTC
At the beginning of function pstPass2 in Parser.php we have the following code. Effective as of around revision 30106:

if ( isset( $wgLocaltimezone ) ) {
        $oldtz = getenv( 'TZ' ); 
        putenv( 'TZ='.$wgLocaltimezone );
}       
$d = $wgContLang->timeanddate( $this->mOptions->getTimestamp(), false, false) . ' (' . date( 'T' ) . ')';
if ( isset( $wgLocaltimezone ) ) {
        putenv( 'TZ='.$oldtz );
} 

The issue with this is that if $wgLocaltimezone is set, $this->mOptions->getTimestamp() seems to return a cached UTC timestamp, while date( 'T' ) returns a the TimeZone abbreviation coordinated with $wgLocaltimezone.

Example, my $wgLocaltimezone is set to "America/Chicago" if I used ~~~~~ in a page at 23:19 Central today (27 January), my timestamp is reported as "05:19, 28 January 2008 (CST)" 

An off the cuff suggestion for solving this is the following:

if ( isset( $wgLocaltimezone ) ) {
        $oldtz = getenv( 'TZ' ); 
        putenv( 'TZ='.$wgLocaltimezone );
        $dtz = date( 'YmdHis' );
} else {
        $dtz = $this->mOptions->getTimestamp();
}
$d = $wgContLang->timeanddate( $dtz , false, false) . ' (' . date( 'T' ) . ')';
if ( isset( $wgLocaltimezone ) ) {
        putenv( 'TZ='.$oldtz );
}
Comment 1 Charlie Huggard 2008-01-30 01:51:40 UTC
Thinking about this more, could it be a better option to create and store a $mLocalTimestamp on the ParserOptions which is set at the same time as the standard timestamp (perhaps add a $local parameter on the getTimestamp() call also)? But I don't know (offhand) where else a LocalTimestamp would be used so it may not be justified to calculate and store both.
Comment 2 Charlie Huggard 2008-01-30 06:10:22 UTC
Looking into it one step further, the timeanddate function in Language.php called here seems to make the appropriate adjustment if if passed with the 2nd parameter being true: (so long as $wgLocalTZoffset is set properly) As $d is only used in putting together signatures, so I would bet that the following would be the best option:

$d = $wgContLang->timeanddate( $this->mOptions->getTimestamp(), isset( $wgLocaltimezone ) , false) . ' (' . date( 'T' ) . ')';

Comment 3 Ilmari Karonen 2008-02-09 20:41:40 UTC
Should be fixed in r30766, based on the earlier suggestion above.  (Passing true as the 2nd parameter to timeanddate() doesn't work right if the user has set a different timezone offset in their preferences.)

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links