From: Aaron Schulz Date: Thu, 30 Oct 2008 10:04:30 +0000 (+0000) Subject: Make getTimestampFromId() need a title. Avoids some secondary lookups and orphans... X-Git-Tag: 1.31.0-rc.0~44509 X-Git-Url: http://git.cyclocoop.org/data/Fool?a=commitdiff_plain;h=e03787afd91c76cfdfd39f4fe19d8e12a00126cc;p=lhc%2Fweb%2Fwiklou.git Make getTimestampFromId() need a title. Avoids some secondary lookups and orphans revs will be overlooked. --- diff --git a/includes/Revision.php b/includes/Revision.php index c68d974ac5..2d8ebc2094 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -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 diff --git a/includes/Skin.php b/includes/Skin.php index 0fe06cc021..b0e0c48906 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -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(); } diff --git a/includes/UserMailer.php b/includes/UserMailer.php index 05ad2b6e62..d3b2b5d989 100644 --- a/includes/UserMailer.php +++ b/includes/UserMailer.php @@ -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