From: Brion Vibber Date: Tue, 27 Mar 2007 19:39:37 +0000 (+0000) Subject: Revert $wgDBtimezone commits: r20688, 20689, 20690, 20691. X-Git-Tag: 1.31.0-rc.0~53581 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/journal.php?a=commitdiff_plain;h=4475d36182e392ee32f3bbdeb445a7d1e7cc49f6;p=lhc%2Fweb%2Fwiklou.git Revert $wgDBtimezone commits: r20688, 20689, 20690, 20691. Alters behavior of wfTimestamp() and wfTimestampNow() in clearly broken ways, such that current time would not return current time anymore. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index fb676e87f2..b6845607e1 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 diff --git a/config/index.php b/config/index.php index 0cf7d48d9f..2fc91f2f3b 100644 --- a/config/index.php +++ b/config/index.php @@ -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 "
  • \n"; print "

    Creating LocalSettings.php...

    \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 diff --git a/includes/DatabasePostgres.php b/includes/DatabasePostgres.php index 9e7d8c63b5..bed25d8547 100644 --- a/includes/DatabasePostgres.php +++ b/includes/DatabasePostgres.php @@ -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 "
  • Checking the version of Postgres..."; $version = $this->getServerVersion(); @@ -165,20 +165,6 @@ class DatabasePostgres extends Database { } print "version $this->numeric_version is OK.
  • \n"; - print "
  • 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'
  • \n"; - } - } - if ($wgDBtimezone === 99) { - print "UNKNOWN. Defaulting to '0'\n"; - } - $safeuser = $this->quote_ident($wgDBuser); ## Are we connecting as a superuser for the first time? if ($wgDBsuperuser) { diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 5ec2121d2d..7b8df3f001 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -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'; /** */ diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index db09675ba1..345b763c15 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -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], diff --git a/languages/Language.php b/languages/Language.php index d331f03768..db2476728d 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -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; }