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
$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;
}
*/
public static function addTitleInfo( &$arr, $title, $prefix = '' ) {
$arr[$prefix . 'ns'] = intval( $title->getNamespace() );
- $arr[$prefix . 'pageid'] = $title->getArticleID();
+ // 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 . 'title'] = $title->getPrefixedText();
}