Revert r106523: abstraction violation, looks very wrong, unclear benefits
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 20 Dec 2011 21:20:50 +0000 (21:20 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 20 Dec 2011 21:20:50 +0000 (21:20 +0000)
includes/Title.php
includes/api/ApiQueryBase.php

index 5119426..2963280 100644 (file)
@@ -2774,15 +2774,6 @@ class Title {
                return $this->mCounter;
        }
 
-       /**
-        * Returns a bool to say whether the Article ID for this title has already been loaded
-        *
-        * @return bool
-        */
-       public function isArticleIDLoaded() {
-               return $this->mArticleID != -1;
-       }
-
        /**
         * Get the article ID for this Title from the link cache,
         * adding it if necessary
@@ -2801,8 +2792,10 @@ class Title {
                        $linkCache->clearLink( $this );
                        $this->mArticleID = $linkCache->addLinkObj( $this );
                        $linkCache->forUpdate( $oldUpdate );
-               } else if ( -1 == $this->mArticleID ) {
-                       $this->mArticleID = $linkCache->addLinkObj( $this );
+               } else {
+                       if ( -1 == $this->mArticleID ) {
+                               $this->mArticleID = $linkCache->addLinkObj( $this );
+                       }
                }
                return $this->mArticleID;
        }
index fdaa630..e3cf51f 100644 (file)
@@ -304,11 +304,7 @@ abstract class ApiQueryBase extends ApiBase {
         */
        public static function addTitleInfo( &$arr, $title, $prefix = '' ) {
                $arr[$prefix . 'ns'] = intval( $title->getNamespace() );
-               // TODO: This is a workaround for bug 28901, as the Article ID isn't always loaded
-               // Saves many DB queries, but does need cleaning up, so callers have always loaded the Article ID also
-               if ( $title->isArticleIDLoaded() ) {
-                       $arr[$prefix . 'pageid'] = $title->getArticleID();
-               }
+               $arr[$prefix . 'pageid'] = $title->getArticleID();
                $arr[$prefix . 'title'] = $title->getPrefixedText();
        }