r42804 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r42803‎ | r42804 | r42805 >
Date:10:04, 30 October 2008
Author:aaron
Status:old
Tags:
Comment:
Make getTimestampFromId() need a title. Avoids some secondary lookups and orphans revs will be overlooked.
Modified paths:
  • /trunk/phase3/includes/Revision.php (modified) (history)
  • /trunk/phase3/includes/Skin.php (modified) (history)
  • /trunk/phase3/includes/UserMailer.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/UserMailer.php
@@ -399,7 +399,7 @@
400400
401401 $this->sendMails();
402402
403 - $latestTimestamp = Revision::getTimestampFromId( $title->getLatestRevID() );
 403+ $latestTimestamp = Revision::getTimestampFromId( $title, $title->getLatestRevID() );
404404 // Do not update watchlists if something else already did.
405405 if ( $timestamp >= $latestTimestamp && ($wgShowUpdatedMarker || $wgEnotifWatchlist) ) {
406406 # Mark the changed watch-listed page with a timestamp, so that the page is
Index: trunk/phase3/includes/Revision.php
@@ -953,15 +953,13 @@
954954
955955 /**
956956 * Get rev_timestamp from rev_id, without loading the rest of the row
 957+ * @param Title $title
957958 * @param integer $id
958 - * @param integer $pageid, optional
959959 */
960 - static function getTimestampFromId( $id, $pageId = 0 ) {
 960+ static function getTimestampFromId( $title, $id ) {
961961 $dbr = wfGetDB( DB_SLAVE );
962962 $conds = array( 'rev_id' => $id );
963 - if( $pageId ) {
964 - $conds['rev_page'] = $pageId;
965 - }
 963+ $conds['rev_page'] = $title->getArticleId();
966964 $timestamp = $dbr->selectField( 'revision', 'rev_timestamp', $conds, __METHOD__ );
967965 if ( $timestamp === false && wfGetLB()->getServerCount() > 1 ) {
968966 # Not in slave, try master
Index: trunk/phase3/includes/Skin.php
@@ -1364,7 +1364,7 @@
13651365 function lastModified() {
13661366 global $wgLang, $wgArticle;
13671367 if( $this->mRevisionId ) {
1368 - $timestamp = Revision::getTimestampFromId( $this->mRevisionId, $wgArticle->getId() );
 1368+ $timestamp = Revision::getTimestampFromId( $wgArticle->getTitle(), $this->mRevisionId );
13691369 } else {
13701370 $timestamp = $wgArticle->getTimestamp();
13711371 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r42926Fixing broken code after r42804: Revision::getTimestampFromId...grondin17:49, 31 October 2008

Status & tagging log