Fix update made in r16659 - now use field revision_timestamp instead of page_touched.
authorJimmy Collins <collinj@users.mediawiki.org>
Tue, 26 Sep 2006 22:45:16 +0000 (22:45 +0000)
committerJimmy Collins <collinj@users.mediawiki.org>
Tue, 26 Sep 2006 22:45:16 +0000 (22:45 +0000)
includes/Parser.php

index 2406691..cb4020d 100644 (file)
@@ -2412,15 +2412,15 @@ class Parser
                        case 'revisionid':
                                return $this->mRevisionId;
                        case 'revisionday':
-                               return intval( substr( $this->mTitle->getTouched(), 6, 2 ) );
+                               return intval( substr( wfRevisionTimestamp( $this->mRevisionId ), 6, 2 ) );
                        case 'revisionday2':
-                               return substr( $this->mTitle->getTouched(), 6, 2 );
+                               return substr( wfRevisionTimestamp( $this->mRevisionId ), 6, 2 );
                        case 'revisionmonth':
-                               return intval( substr( $this->mTitle->getTouched(), 4, 2 ) );
+                               return intval( substr( wfRevisionTimestamp( $this->mRevisionId ), 4, 2 ) );
                        case 'revisionyear':
-                               return substr( $this->mTitle->getTouched(), 0, 4 );
+                               return substr( wfRevisionTimestamp( $this->mRevisionId ), 0, 4 );
                        case 'revisiontimestamp':
-                               return $this->mTitle->getTouched();
+                               return wfRevisionTimestamp( $this->mRevisionId );
                        case 'namespace':
                                return str_replace('_',' ',$wgContLang->getNsText( $this->mTitle->getNamespace() ) );
                        case 'namespacee':
@@ -4882,6 +4882,26 @@ function wfLoadSiteStats() {
        }
 }
 
+/**
+ * Get revision timestamp from the database considering timecorrection
+ *
+ * @param $id Int: page revision id
+ * @return integer
+ */
+function wfRevisionTimestamp( $id ) {
+       global $wgContLang;
+       $fname = 'wfRevisionTimestamp';
+       
+       wfProfileIn( $fname );
+       $dbr =& wfGetDB( DB_SLAVE );
+       $timestamp = $dbr->selectField( 'revision', 'rev_timestamp',
+                       array( 'rev_id' => $id ), __METHOD__ );
+       $timestamp = $wgContLang->userAdjust( $timestamp );
+       wfProfileOut( $fname );
+
+       return $timestamp;
+}
+
 /**
  * Escape html tags
  * Basically replacing " > and < with HTML entities ( &quot;, &gt;, &lt;)