r40342 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40341‎ | r40342 | r40343 >
Date:21:29, 2 September 2008
Author:aaron
Status:old
Tags:
Comment:
Make getLatestRevID faster
Modified paths:
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Title.php
@@ -1979,14 +1979,14 @@
19801980 * @return \type{\int}
19811981 */
19821982 public function getLatestRevID( $flags = 0 ) {
1983 - if ($this->mLatestID !== false)
 1983+ if( $this->mLatestID !== false )
19841984 return $this->mLatestID;
19851985
19861986 $db = ($flags & GAID_FOR_UPDATE) ? wfGetDB(DB_MASTER) : wfGetDB(DB_SLAVE);
1987 - return $this->mLatestID = $db->selectField( 'revision',
1988 - "max(rev_id)",
1989 - array('rev_page' => $this->getArticleID($flags)),
1990 - 'Title::getLatestRevID' );
 1987+ $this->mLatestID = $db->selectField( 'page', 'page_latest',
 1988+ array( 'page_namespace' => $this->getNamespace(), 'page_title' => $this->getDBKey() ),
 1989+ __METHOD__ );
 1990+ return $this->mLatestID;
19911991 }
19921992
19931993 /**