Make pageCond() use PK is ID is already cached
authorAaron Schulz <aaron@users.mediawiki.org>
Mon, 8 Dec 2008 22:30:58 +0000 (22:30 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Mon, 8 Dec 2008 22:30:58 +0000 (22:30 +0000)
includes/Title.php

index da5ac50..792f475 100644 (file)
@@ -2978,7 +2978,11 @@ class Title {
         * @return \type{\array} Selection array
         */
        public function pageCond() {
-               return array( 'page_namespace' => $this->mNamespace, 'page_title' => $this->mDbkeyform );
+               if( $this->mArticleID > 0 ) {
+                       return array( 'page_id' => $this->mArticleID ); // PK avoids secondary lookups
+               } else {
+                       return array( 'page_namespace' => $this->mNamespace, 'page_title' => $this->mDbkeyform );
+               }
        }
 
        /**