Make getLatestRevID faster
authorAaron Schulz <aaron@users.mediawiki.org>
Tue, 2 Sep 2008 21:29:22 +0000 (21:29 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Tue, 2 Sep 2008 21:29:22 +0000 (21:29 +0000)
includes/Title.php

index 0713344..1dbe78d 100644 (file)
@@ -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;
        }
 
        /**