Register a default value for the timecorrection preference
authorBrian Wolff <bawolff+wn@gmail.com>
Fri, 5 Aug 2016 08:17:48 +0000 (08:17 +0000)
committerBrian Wolff <bawolff+wn@gmail.com>
Fri, 5 Aug 2016 08:17:48 +0000 (08:17 +0000)
Previously it had no default value, which means that certain
things did not consider it a real option (e.g. userOptions.php).
Additionally, this was causing preferences to get confused into
thinking that users who did not set a timezone have really selected
offset 00:00, so saving the page could change the user's timezone
to UTC even if they did not touch the setting.

Change-Id: I875c5ab6472324f9bdfdaa784441fbc381087707

includes/Setup.php

index 6c5de90..22462c0 100644 (file)
@@ -654,6 +654,9 @@ date_default_timezone_set( $wgLocaltimezone );
 if ( is_null( $wgLocalTZoffset ) ) {
        $wgLocalTZoffset = date( 'Z' ) / 60;
 }
+// The part after the System| is ignored, but rest of MW fills it
+// out as the local offset.
+$wgDefaultUserOptions['timecorrection'] = "System|$wgLocalTZoffset";
 
 if ( !$wgDBerrorLogTZ ) {
        $wgDBerrorLogTZ = $wgLocaltimezone;