From: Brion Vibber Date: Mon, 30 Jun 2003 01:33:16 +0000 (+0000) Subject: Date/time fixes: try to ensure that timestamps are always kept in GMT, with conversio... X-Git-Tag: 1.1.0~473 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22auteur_infos%22%2C%20%22id_auteur=%24id%22%29%20.%20%22?a=commitdiff_plain;h=f92d41d6c30eb09272f2a55216eaa24ed47d61f1;p=lhc%2Fweb%2Fwiklou.git Date/time fixes: try to ensure that timestamps are always kept in GMT, with conversion where necessary. --- diff --git a/includes/Article.php b/includes/Article.php index ea9e958222..cf242dfa21 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1528,7 +1528,8 @@ name=\"wpSummary\" maxlength=200 size=60>
if(isset($wgLocaltimezone)) { $oldtz = getenv("TZ"); putenv("TZ=$wgLocaltimezone"); } - $d = $wgLang->timeanddate( wfTimestampNow(), false ) . + /* Note: this is an ugly timezone hack for the European wikis */ + $d = $wgLang->timeanddate( date( "YmdHis" ), false ) . " (" . date( "T" ) . ")"; if(isset($wgLocaltimezone)) putenv("TZ=$oldtz"); diff --git a/includes/DatabaseFunctions.php b/includes/DatabaseFunctions.php index 3d930472e0..bcec86d45b 100644 --- a/includes/DatabaseFunctions.php +++ b/includes/DatabaseFunctions.php @@ -107,19 +107,19 @@ function wfStrencode( $s ) # Ideally we'd be using actual time fields in the db function wfTimestamp2Unix( $ts ) { - return mktime( ( (int)substr( $ts, 8, 2) ), + return gmmktime( ( (int)substr( $ts, 8, 2) ), (int)substr( $ts, 10, 2 ), (int)substr( $ts, 12, 2 ), (int)substr( $ts, 4, 2 ), (int)substr( $ts, 6, 2 ), (int)substr( $ts, 0, 4 ) ); } function wfUnix2Timestamp( $unixtime ) { - return date( "YmdHis", $unixtime ); + return gmdate( "YmdHis", $unixtime ); } function wfTimestampNow() { # return NOW - return date( "YmdHis" ); + return gmdate( "YmdHis" ); } # Sorting hack for MySQL 3, which doesn't use index sorts for DESC diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 124711b22f..2a766338ef 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -386,7 +386,7 @@ function wfRecordUpload( $name, $oldver, $size, $desc ) if ( 0 == wfNumRows( $res ) ) { $sql = "INSERT INTO image (img_name,img_size,img_timestamp," . "img_description,img_user,img_user_text) VALUES ('" . - wfStrencode( $name ) . "',{$size},'" . date( "YmdHis" ) . "','" . + wfStrencode( $name ) . "',{$size},'" . wfTimestampNow() . "','" . wfStrencode( $desc ) . "', '" . $wgUser->getID() . "', '" . wfStrencode( $wgUser->getName() ) . "')"; wfQuery( $sql, $fname ); @@ -432,7 +432,7 @@ function wfRecordUpload( $name, $oldver, $size, $desc ) wfQuery( $sql, $fname ); $sql = "UPDATE image SET img_size={$size}," . - "img_timestamp='" . date( "YmdHis" ) . "',img_user='" . + "img_timestamp='" . wfTimestampNow() . "',img_user='" . $wgUser->getID() . "',img_user_text='" . wfStrencode( $wgUser->getName() ) . "', img_description='" . wfStrencode( $desc ) . "' WHERE img_name='" . diff --git a/includes/LogPage.php b/includes/LogPage.php index 45d2d3512d..bd8c928457 100644 --- a/includes/LogPage.php +++ b/includes/LogPage.php @@ -104,7 +104,7 @@ class LogPage { } else { $ul = $ut; } - $d = $wgLang->timeanddate( date( "YmdHis" ), false ); + $d = $wgLang->timeanddate( wfTimestampNow(), false ); preg_match( "/^(.*?)