Revert $wgDBtimezone commits: r20688, 20689, 20690, 20691.
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 27 Mar 2007 19:39:37 +0000 (19:39 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 27 Mar 2007 19:39:37 +0000 (19:39 +0000)
Alters behavior of wfTimestamp() and wfTimestampNow() in clearly broken ways, such that current time would not return current time anymore.

RELEASE-NOTES
config/index.php
includes/DatabasePostgres.php
includes/DefaultSettings.php
includes/GlobalFunctions.php
languages/Language.php

index fb676e8..b684560 100644 (file)
@@ -29,7 +29,6 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   $wgAutoConfirmCount (defaulting to zero, naturally).
 * Added rate limiter for Special:Emailuser
 * Private logs can now be created using $wgLogRestrictions
-* Databases using timestamps with time zone (Postgres) can now set $wgDBtimezone
 
 == New features since 1.9 ==
 * (bug 6937) Introduce "statistics-footer" message, appended to 
@@ -284,7 +283,6 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 4777) Separate prev/next messages for Special:Whatlinkshere
 * Merge approx 15 missing Wikipedia language codes into wikipedia-interwiki.sql
   based on Jeff Merkey's mediawiki-1.9.3.WG-20070316.tar.gz.bz2 archive.
-* (bug 9299) Allow user timezones to work with Postgres
 * (bug 9411) Fix for shared image descriptions using query-string titles
 * (bug 4756) Add user tool links for self created accounts at special:log
   instead of sometimes broken block links from newuserlog extension
index 0cf7d48..2fc91f2 100644 (file)
@@ -902,11 +902,6 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) {
                        $article->updateRevisionOn( $wgDatabase, $revision );
                }
 
-               # If the database has a specific timezone, and its not the default(0), change LocalSettings.php
-               if ($wgDBtimezone != 0) {
-                       $local = preg_replace('/(wgDBtimezone\s+= )0/', "$1$wgDBtimezone", $local);
-               }
-
                /* Write out the config file now that all is well */
                print "<li style=\"list-style: none\">\n";
                print "<p>Creating LocalSettings.php...</p>\n\n";
@@ -1412,7 +1407,6 @@ if ( \$wgCommandLineMode ) {
 \$wgDBuser           = \"{$slconf['DBuser']}\";
 \$wgDBpassword       = \"{$slconf['DBpassword']}\";
 \$wgDBport           = \"{$slconf['DBport']}\";
-\$wgDBtimezone       = 0;
 \$wgDBprefix         = \"{$slconf['DBprefix']}\";
 
 # Schemas for Postgres
index 9e7d8c6..bed25d8 100644 (file)
@@ -154,7 +154,7 @@ class DatabasePostgres extends Database {
                ## If this is the initial connection, setup the schema stuff and possibly create the user
                if (defined('MEDIAWIKI_INSTALL')) {
                        global $wgDBname, $wgDBuser, $wgDBpassword, $wgDBsuperuser, $wgDBmwschema,
-                               $wgDBts2schema, $wgDBtimezone;
+                               $wgDBts2schema;
 
                        print "<li>Checking the version of Postgres...";
                        $version = $this->getServerVersion();
@@ -165,20 +165,6 @@ class DatabasePostgres extends Database {
                        }
                        print "version $this->numeric_version is OK.</li>\n";
 
-                       print "<li>Figuring out timezone the database is using...";
-                       ## Figure out what the local timezone is for this database
-                       $wgDBtimezone = 99;
-                       if ($this->doQuery("SET datestyle TO ISO")) {
-                               $res = $this->doQuery("SELECT substring(now() FROM E'-?\\\d\\\d\$')::int");
-                               if ($res) {
-                                       $wgDBtimezone = pg_fetch_result($res,0,0);
-                                       print "timezone is '$wgDBtimezone'</li>\n";
-                               }
-                       }
-                       if ($wgDBtimezone === 99) {
-                               print "<b>UNKNOWN</b>. Defaulting to '0'</li>\n";
-                       }
-
                        $safeuser = $this->quote_ident($wgDBuser);
                        ## Are we connecting as a superuser for the first time?
                        if ($wgDBsuperuser) {
index 5ec2121..7b8df3f 100644 (file)
@@ -485,8 +485,6 @@ $wgSMTP                             = false;
 $wgDBserver         = 'localhost';
 /** database port number */
 $wgDBport           = '';
-/** timezone the database is using */
-$wgDBtimezone       = 0;
 /** name of the database */
 $wgDBname           = 'wikidb';
 /** */
index db09675..345b763 100644 (file)
@@ -1337,7 +1337,7 @@ function wfArrayLookup( $a, $b ) {
  */
 function wfTimestampNow() {
        # return NOW
-       return wfTimestamp( TS_MW, 0 );
+       return wfTimestamp( TS_MW, time() );
 }
 
 /**
@@ -1424,11 +1424,10 @@ define('TS_POSTGRES', 7);
  * @return string Time in the format specified in $outputtype
  */
 function wfTimestamp($outputtype=TS_UNIX,$ts=0) {
-       global $wgDBtimezone;
        $uts = 0;
        $da = array();
        if ($ts==0) {
-               $uts=time() - 60*60*$wgDBtimezone;
+               $uts=time();
        } elseif (preg_match('/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)$/D',$ts,$da)) {
                # TS_DB
                $uts=gmmktime((int)$da[4],(int)$da[5],(int)$da[6],
index d331f03..db24767 100644 (file)
@@ -391,7 +391,7 @@ class Language {
         * @return int
         */
        function userAdjust( $ts, $tz = false ) {
-               global $wgUser, $wgLocalTZoffset, $wgDBtimezone;
+               global $wgUser, $wgLocalTZoffset;
 
                if (!$tz) {
                        $tz = $wgUser->getOption( 'timecorrection' );
@@ -415,11 +415,6 @@ class Language {
                        $hrDiff = intval( $tz );
                }
 
-               # Account for databases that use timestamp with time zone
-               if ( isset($wgDBtimezone) and $tz ) {
-                       $hrDiff -= $wgDBtimezone;
-               }
-
                # No difference ? Return time unchanged
                if ( 0 == $hrDiff && 0 == $minDiff ) { return $ts; }