* Revert r35469.
authorRobert Leverington <roberthl@users.mediawiki.org>
Wed, 28 May 2008 17:54:12 +0000 (17:54 +0000)
committerRobert Leverington <roberthl@users.mediawiki.org>
Wed, 28 May 2008 17:54:12 +0000 (17:54 +0000)
* For some reason PHP doesn't always report errors even when error reporting is set to maxmium.
* The date\time system needs some sort of work doing to it, there is stuff for it spread everywhere and no definite timezone.
* Regardless, an E_STRICT level error does not constitute a major severity and High priority bug.

RELEASE-NOTES
includes/DefaultSettings.php
includes/GlobalFunctions.php
includes/Parser.php
includes/Parser_OldPP.php

index 5f0ee3c..6cdbb88 100644 (file)
@@ -302,8 +302,6 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   disabling $wgStrictFileExtensions
 * (bug 14241) Pages can no longer be protected to levels you are not in
 * (bug 14296) Fix local name of ang: (Anglo-Saxon)
-* (bug 7715) Use date_default_timezone_* instead of TZ environment variable if
-  available
 * (bug 4871) Hardcoded superscript in time zone preferences moved to message
 
 === API changes in 1.13 ===
index 550d7d8..992be45 100644 (file)
@@ -2444,7 +2444,7 @@ $wgLocaltimezone = null;
  * this in conjunction with the signature timezone and override the TZ
  * environment variable like so:
  *   $wgLocaltimezone="Europe/Berlin";
- *   date_default_timezone_set( $wgLocaltimezone );
+ *   putenv("TZ=$wgLocaltimezone");
  *   $wgLocalTZoffset = date("Z") / 60;
  *
  * Leave at NULL to show times in universal time (UTC/GMT).
index e51fc71..3294c8f 100644 (file)
@@ -87,28 +87,6 @@ if ( !function_exists( 'array_diff_key' ) ) {
        }
 }
 
-if ( !function_exists( 'date_default_timezone_get' ) ) {
-       /**
-        * Exists in PHP 5.1.0+
-        * Simulates functionality partially.
-        * @return String: Environment timezone.
-        */
-       function date_default_timezone_get() {
-               return getenv( 'TZ' );
-       }
-}
-if ( !function_exists( 'date_default_timezone_set' ) ) {
-       /**
-        * Exists in PHP 5.1.0+
-        * Simulates functionality partially.
-        * @param String: Timezone to set to.
-        * @return Boolean: Indication regarding if setting was successful.
-        */
-       function date_default_timezone_set( $setting ) {
-               return putenv( 'TZ=' . $setting );
-       }
-}
-
 /**
  * Like array_diff( $a, $b ) except that it works with two-dimensional arrays.
  */
index a467f8d..0b8497f 100644 (file)
@@ -2381,10 +2381,11 @@ class Parser
                # Use the time zone
                global $wgLocaltimezone;
                if ( isset( $wgLocaltimezone ) ) {
-                       $oldtz = date_default_timezone_get();
-                       date_default_timezone_set( $wgLocaltimezone );
+                       $oldtz = getenv( 'TZ' );
+                       putenv( 'TZ='.$wgLocaltimezone );
                }
 
+               wfSuppressWarnings(); // E_STRICT system time bitching
                $localTimestamp = date( 'YmdHis', $ts );
                $localMonth = date( 'm', $ts );
                $localMonthName = date( 'n', $ts );
@@ -2395,8 +2396,9 @@ class Parser
                $localYear = date( 'Y', $ts );
                $localHour = date( 'H', $ts );
                if ( isset( $wgLocaltimezone ) ) {
-                       date_default_timezone_set( $oldtz );
+                       putenv( 'TZ='.$oldtz );
                }
+               wfRestoreWarnings();
 
                switch ( $index ) {
                        case 'currentmonth':
@@ -3701,11 +3703,11 @@ class Parser
                $tz = 'UTC';
                if ( isset( $wgLocaltimezone ) ) {
                        $unixts = wfTimestamp( TS_UNIX, $ts );
-                       $oldtz = date_default_timezone_get();
-                       date_default_timezone_set( $wgLocaltimezone );
+                       $oldtz = getenv( 'TZ' );
+                       putenv( 'TZ='.$wgLocaltimezone );
                        $ts = date( 'YmdHis', $unixts );
                        $tz = date( 'T', $unixts );  # might vary on DST changeover!
-                       date_default_timezone_set( $oldtz );
+                       putenv( 'TZ='.$oldtz );
                }
                $d = $wgContLang->timeanddate( $ts, false, false ) . " ($tz)";
 
index f2f1b72..57a981e 100644 (file)
@@ -2402,10 +2402,11 @@ class Parser_OldPP
                # Use the time zone
                global $wgLocaltimezone;
                if ( isset( $wgLocaltimezone ) ) {
-                       $oldtz = date_default_timezone_get();
-                       date_default_timezone_set( $wgLocaltimezone );
+                       $oldtz = getenv( 'TZ' );
+                       putenv( 'TZ='.$wgLocaltimezone );
                }
 
+               wfSuppressWarnings(); // E_STRICT system time bitching
                $localTimestamp = date( 'YmdHis', $ts );
                $localMonth = date( 'm', $ts );
                $localMonthName = date( 'n', $ts );
@@ -2416,8 +2417,9 @@ class Parser_OldPP
                $localYear = date( 'Y', $ts );
                $localHour = date( 'H', $ts );
                if ( isset( $wgLocaltimezone ) ) {
-                       date_default_timezone_set( $oldtz );
+                       putenv( 'TZ='.$oldtz );
                }
+               wfRestoreWarnings();
 
                switch ( $index ) {
                        case 'currentmonth':
@@ -3779,13 +3781,13 @@ class Parser_OldPP
                 * than the one selected in each user's preferences.
                 */
                if ( isset( $wgLocaltimezone ) ) {
-                       $oldtz = date_default_timezone_get();
-                       date_default_timezone_set( $wgLocaltimezone );
+                       $oldtz = getenv( 'TZ' );
+                       putenv( 'TZ='.$wgLocaltimezone );
                }
                $d = $wgContLang->timeanddate( date( 'YmdHis' ), false, false) .
                  ' (' . date( 'T' ) . ')';
                if ( isset( $wgLocaltimezone ) ) {
-                       date_default_timezone_set( $oldtz );
+                       putenv( 'TZ='.$oldtz );
                }
 
                # Variable replacement