From 95bbbeb606e07cf328a7a3a395bfe009d01c8a3e Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 2 Sep 2008 21:29:22 +0000 Subject: [PATCH] Make getLatestRevID faster --- includes/Title.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/includes/Title.php b/includes/Title.php index 071334444e..1dbe78d6a1 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1979,14 +1979,14 @@ class Title { * @return \type{\int} */ public function getLatestRevID( $flags = 0 ) { - if ($this->mLatestID !== false) + if( $this->mLatestID !== false ) return $this->mLatestID; $db = ($flags & GAID_FOR_UPDATE) ? wfGetDB(DB_MASTER) : wfGetDB(DB_SLAVE); - return $this->mLatestID = $db->selectField( 'revision', - "max(rev_id)", - array('rev_page' => $this->getArticleID($flags)), - 'Title::getLatestRevID' ); + $this->mLatestID = $db->selectField( 'page', 'page_latest', + array( 'page_namespace' => $this->getNamespace(), 'page_title' => $this->getDBKey() ), + __METHOD__ ); + return $this->mLatestID; } /** -- 2.20.1