Would anyone have objections to deprecating $wgLocaltimezone and $wgLocalTZoffset, and instead just basing local time calculations on PHP's own notion of the local time zone (which can be set in LocalSettings.php with putenv("TZ=...") or, for PHP 5.1.0 and above, date_default_timezone_set())? It seems to me that we're already relying on PHP's own timezone handling so much that we might as well go the whole hog, and fix a bunch of actual and potential bugs in the process.
(This occurred to me while I was fixing bug 12815 and stumbling into all sorts of wacky time zone weirdness. I really don't see any cleaner way of fixing the whole mess than getting rid of both of these redundant config variables entirely. The documentation of $wgLocalTZoffset alone is a WTF in itself, seeing as the meaning of its value apparently changed from hours to minutes(!) somewhere around version 1.7.0.)
In particular, this should allow people running PHP 5.1.0+ in safe mode to change the time zone from the server default (bug 2658).
Ilmari Karonen wrote:
Would anyone have objections to deprecating $wgLocaltimezone and $wgLocalTZoffset,
Yes, if there's not a clean replacement.
and instead just basing local time calculations on PHP's own notion of the local time zone (which can be set in LocalSettings.php with putenv("TZ=...")
IIRC, putenv() isn't allowed in safe_mode so won't be available on many shared hosts.
or, for PHP 5.1.0 and above, date_default_timezone_set())? It seems to me that we're already relying on PHP's own timezone handling so much that we might as well go the whole hog, and fix a bunch of actual and potential bugs in the process.
(This occurred to me while I was fixing bug 12815 and stumbling into all sorts of wacky time zone weirdness. I really don't see any cleaner way of fixing the whole mess than getting rid of both of these redundant config variables entirely. The documentation of $wgLocalTZoffset alone is a WTF in itself, seeing as the meaning of its value apparently changed from hours to minutes(!) somewhere around version 1.7.0.)
In particular, this should allow people running PHP 5.1.0+ in safe mode to change the time zone from the server default (bug 2658).
The sensible thing is probably to set up the time zone in the correct fashion based on the configuration variables.
-- brion vibber (brion @ wikimedia.org)
wikitech-l@lists.wikimedia.org