Make getTimestampFromId() need a title. Avoids some secondary lookups and orphans...
authorAaron Schulz <aaron@users.mediawiki.org>
Thu, 30 Oct 2008 10:04:30 +0000 (10:04 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Thu, 30 Oct 2008 10:04:30 +0000 (10:04 +0000)
includes/Revision.php
includes/Skin.php
includes/UserMailer.php

index c68d974..2d8ebc2 100644 (file)
@@ -953,15 +953,13 @@ class Revision {
 
        /**
         * Get rev_timestamp from rev_id, without loading the rest of the row
+        * @param Title $title
         * @param integer $id
-        * @param integer $pageid, optional
         */
-       static function getTimestampFromId( $id, $pageId = 0 ) {
+       static function getTimestampFromId( $title, $id ) {
                $dbr = wfGetDB( DB_SLAVE );
                $conds = array( 'rev_id' => $id );
-               if( $pageId ) {
-                       $conds['rev_page'] = $pageId;
-               }
+               $conds['rev_page'] = $title->getArticleId();
                $timestamp = $dbr->selectField( 'revision', 'rev_timestamp', $conds, __METHOD__ );
                if ( $timestamp === false && wfGetLB()->getServerCount() > 1 ) {
                        # Not in slave, try master
index 0fe06cc..b0e0c48 100644 (file)
@@ -1364,7 +1364,7 @@ END;
        function lastModified() {
                global $wgLang, $wgArticle;
                if( $this->mRevisionId ) {
-                       $timestamp = Revision::getTimestampFromId( $this->mRevisionId, $wgArticle->getId() );
+                       $timestamp = Revision::getTimestampFromId( $wgArticle->getTitle(), $this->mRevisionId );
                } else {
                        $timestamp = $wgArticle->getTimestamp();
                }
index 05ad2b6..d3b2b5d 100644 (file)
@@ -399,7 +399,7 @@ class EmailNotification {
 
                $this->sendMails();
 
-               $latestTimestamp = Revision::getTimestampFromId( $title->getLatestRevID() );
+               $latestTimestamp = Revision::getTimestampFromId( $title, $title->getLatestRevID() );
                // Do not update watchlists if something else already did.
                if ( $timestamp >= $latestTimestamp && ($wgShowUpdatedMarker || $wgEnotifWatchlist) ) {
                        # Mark the changed watch-listed page with a timestamp, so that the page is