Index: trunk/phase3/includes/Setup.php |
— | — | @@ -140,7 +140,6 @@ |
141 | 141 | ); |
142 | 142 | } |
143 | 143 | |
144 | | - |
145 | 144 | if ( !class_exists( 'AutoLoader' ) ) { |
146 | 145 | require_once( "$IP/includes/AutoLoader.php" ); |
147 | 146 | } |
— | — | @@ -160,9 +159,19 @@ |
161 | 160 | require_once( "$IP/includes/StubObject.php" ); |
162 | 161 | wfProfileOut( $fname.'-includes' ); |
163 | 162 | wfProfileIn( $fname.'-misc1' ); |
| 163 | + |
164 | 164 | # Raise the memory limit if it's too low |
165 | 165 | wfMemoryLimit(); |
166 | 166 | |
| 167 | +/** |
| 168 | + * Set up the timezone, suppressing the pseudo-security warning in PHP 5.1+ |
| 169 | + * that happens whenever you use a date function without the timezone being |
| 170 | + * explicitly set. Inspired by phpMyAdmin's treatment of the problem. |
| 171 | + */ |
| 172 | +wfSuppressWarnings(); |
| 173 | +date_default_timezone_set( date_default_timezone_get() ); |
| 174 | +wfRestoreWarnings(); |
| 175 | + |
167 | 176 | $wgIP = false; # Load on demand |
168 | 177 | # Can't stub this one, it sets up $_GET and $_REQUEST in its constructor |
169 | 178 | $wgRequest = new WebRequest; |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -3080,10 +3080,10 @@ |
3081 | 3081 | /** |
3082 | 3082 | * Fake out the timezone that the server thinks it's in. This will be used for |
3083 | 3083 | * date display and not for what's stored in the DB. Leave to null to retain |
3084 | | - * your server's OS-based timezone value. This is the same as the timezone. |
| 3084 | + * your server's OS-based timezone value. |
3085 | 3085 | * |
3086 | | - * This variable is currently used ONLY for signature formatting, not for |
3087 | | - * anything else. |
| 3086 | + * This variable is currently used only for signature formatting and for local |
| 3087 | + * time/date parser variables ({{LOCALTIME}} etc.) |
3088 | 3088 | * |
3089 | 3089 | * Timezones can be translated by editing MediaWiki messages of type |
3090 | 3090 | * timezone-nameinlowercase like timezone-utc. |
— | — | @@ -3105,10 +3105,10 @@ |
3106 | 3106 | * $wgLocalTZoffset = date("Z") / 60; |
3107 | 3107 | * |
3108 | 3108 | * If your server is not configured for the timezone you want, you can set |
3109 | | - * this in conjunction with the signature timezone and override the TZ |
3110 | | - * environment variable like so: |
| 3109 | + * this in conjunction with the signature timezone and override the PHP default |
| 3110 | + * timezone like so: |
3111 | 3111 | * $wgLocaltimezone="Europe/Berlin"; |
3112 | | - * putenv("TZ=$wgLocaltimezone"); |
| 3112 | + * date_default_timezone_set( $wgLocaltimezone ); |
3113 | 3113 | * $wgLocalTZoffset = date("Z") / 60; |
3114 | 3114 | * |
3115 | 3115 | * Leave at NULL to show times in universal time (UTC/GMT). |
Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -2332,11 +2332,10 @@ |
2333 | 2333 | # Use the time zone |
2334 | 2334 | global $wgLocaltimezone; |
2335 | 2335 | if ( isset( $wgLocaltimezone ) ) { |
2336 | | - $oldtz = getenv( 'TZ' ); |
2337 | | - putenv( 'TZ='.$wgLocaltimezone ); |
| 2336 | + $oldtz = date_default_timezone_get(); |
| 2337 | + date_default_timezone_set( $wgLocaltimezone ); |
2338 | 2338 | } |
2339 | 2339 | |
2340 | | - wfSuppressWarnings(); // E_STRICT system time bitching |
2341 | 2340 | $localTimestamp = date( 'YmdHis', $ts ); |
2342 | 2341 | $localMonth = date( 'm', $ts ); |
2343 | 2342 | $localMonth1 = date( 'n', $ts ); |
— | — | @@ -2348,9 +2347,8 @@ |
2349 | 2348 | $localYear = date( 'Y', $ts ); |
2350 | 2349 | $localHour = date( 'H', $ts ); |
2351 | 2350 | if ( isset( $wgLocaltimezone ) ) { |
2352 | | - putenv( 'TZ='.$oldtz ); |
| 2351 | + date_default_timezone_set( $oldtz ); |
2353 | 2352 | } |
2354 | | - wfRestoreWarnings(); |
2355 | 2353 | |
2356 | 2354 | switch ( $index ) { |
2357 | 2355 | case 'currentmonth': |
— | — | @@ -3965,27 +3963,30 @@ |
3966 | 3964 | * (see also bug 12815) |
3967 | 3965 | */ |
3968 | 3966 | $ts = $this->mOptions->getTimestamp(); |
3969 | | - $tz = wfMsgForContent( 'timezone-utc' ); |
3970 | 3967 | if ( isset( $wgLocaltimezone ) ) { |
3971 | | - $unixts = wfTimestamp( TS_UNIX, $ts ); |
3972 | | - $oldtz = getenv( 'TZ' ); |
3973 | | - putenv( 'TZ='.$wgLocaltimezone ); |
3974 | | - $ts = date( 'YmdHis', $unixts ); |
3975 | | - $tz = date( 'T', $unixts ); # might vary on DST changeover! |
| 3968 | + $tz = $wgLocaltimezone; |
| 3969 | + } else { |
| 3970 | + $tz = date_default_timezone_get(); |
| 3971 | + } |
3976 | 3972 | |
3977 | | - /* Allow translation of timezones trough wiki. date() can return |
3978 | | - * whatever crap the system uses, localised or not, so we cannot |
3979 | | - * ship premade translations. |
3980 | | - */ |
3981 | | - $key = 'timezone-' . strtolower( trim( $tz ) ); |
3982 | | - $value = wfMsgForContent( $key ); |
3983 | | - if ( !wfEmptyMsg( $key, $value ) ) $tz = $value; |
| 3973 | + $unixts = wfTimestamp( TS_UNIX, $ts ); |
| 3974 | + $oldtz = date_default_timezone_get(); |
| 3975 | + date_default_timezone_set( $tz ); |
| 3976 | + $ts = date( 'YmdHis', $unixts ); |
| 3977 | + $tzMsg = date( 'T', $unixts ); # might vary on DST changeover! |
3984 | 3978 | |
3985 | | - putenv( 'TZ='.$oldtz ); |
3986 | | - } |
| 3979 | + /* Allow translation of timezones trough wiki. date() can return |
| 3980 | + * whatever crap the system uses, localised or not, so we cannot |
| 3981 | + * ship premade translations. |
| 3982 | + */ |
| 3983 | + $key = 'timezone-' . strtolower( trim( $tzMsg ) ); |
| 3984 | + $value = wfMsgForContent( $key ); |
| 3985 | + if ( !wfEmptyMsg( $key, $value ) ) $tzMsg = $value; |
3987 | 3986 | |
3988 | | - $d = $wgContLang->timeanddate( $ts, false, false ) . " ($tz)"; |
| 3987 | + date_default_timezone_set( $oldtz ); |
3989 | 3988 | |
| 3989 | + $d = $wgContLang->timeanddate( $ts, false, false ) . " ($tzMsg)"; |
| 3990 | + |
3990 | 3991 | # Variable replacement |
3991 | 3992 | # Because mOutputType is OT_WIKI, this will only process {{subst:xxx}} type tags |
3992 | 3993 | $text = $this->replaceVariables( $text ); |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -84,7 +84,12 @@ |
85 | 85 | * $wgUploadNavigationUrl now also affects images inline images that do not |
86 | 86 | exist. In that case the URL will get (?|&)wpDestFile=<filename> appended to |
87 | 87 | it as appropriate. |
88 | | - |
| 88 | +* If $wgLocaltimezone is null, use the server's timezone as the default for |
| 89 | + signatures. This was always the behaviour documented in DefaultSettings.php |
| 90 | + but has not been the actual behaviour for some time: instead, UTC was used |
| 91 | + by default. |
| 92 | + |
| 93 | + |
89 | 94 | === New features in 1.16 === |
90 | 95 | |
91 | 96 | * Add CSS defintion of the 'wikitable' class to shared.css |
— | — | @@ -683,6 +688,7 @@ |
684 | 689 | type selector on Special:Log |
685 | 690 | * (bug 20115) Special:Userlogin title says "Log in / create account" even if the |
686 | 691 | user can't create an account |
| 692 | +* (bug 2658) Don't attempt to set the TZ environment variable. |
687 | 693 | |
688 | 694 | == API changes in 1.16 == |
689 | 695 | |