r106862 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106861‎ | r106862 | r106863 >
Date:21:20, 20 December 2011
Author:brion
Status:ok (Comments)
Tags:
Comment:
Revert r106523: abstraction violation, looks very wrong, unclear benefits
Modified paths:
  • /trunk/phase3/includes/Title.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryBase.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Title.php
@@ -2775,15 +2775,6 @@
27762776 }
27772777
27782778 /**
2779 - * Returns a bool to say whether the Article ID for this title has already been loaded
2780 - *
2781 - * @return bool
2782 - */
2783 - public function isArticleIDLoaded() {
2784 - return $this->mArticleID != -1;
2785 - }
2786 -
2787 - /**
27882779 * Get the article ID for this Title from the link cache,
27892780 * adding it if necessary
27902781 *
@@ -2801,8 +2792,10 @@
28022793 $linkCache->clearLink( $this );
28032794 $this->mArticleID = $linkCache->addLinkObj( $this );
28042795 $linkCache->forUpdate( $oldUpdate );
2805 - } else if ( -1 == $this->mArticleID ) {
2806 - $this->mArticleID = $linkCache->addLinkObj( $this );
 2796+ } else {
 2797+ if ( -1 == $this->mArticleID ) {
 2798+ $this->mArticleID = $linkCache->addLinkObj( $this );
 2799+ }
28072800 }
28082801 return $this->mArticleID;
28092802 }
Index: trunk/phase3/includes/api/ApiQueryBase.php
@@ -304,11 +304,7 @@
305305 */
306306 public static function addTitleInfo( &$arr, $title, $prefix = '' ) {
307307 $arr[$prefix . 'ns'] = intval( $title->getNamespace() );
308 - // TODO: This is a workaround for bug 28901, as the Article ID isn't always loaded
309 - // Saves many DB queries, but does need cleaning up, so callers have always loaded the Article ID also
310 - if ( $title->isArticleIDLoaded() ) {
311 - $arr[$prefix . 'pageid'] = $title->getArticleID();
312 - }
 308+ $arr[$prefix . 'pageid'] = $title->getArticleID();
313309 $arr[$prefix . 'title'] = $title->getPrefixedText();
314310 }
315311

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r106523Per bug 28901, and Duplicatebug on r105831, only list the Article ID if it ha...reedy19:55, 17 December 2011

Comments

#Comment by Duplicatebug (talk | contribs)   20:45, 21 December 2011

By the way: It is hard to change all queries to have the pageid set or call the right factory method of title, because there a some extension with api modules. Some people using the extenions across mediawiki versions and when using an old extension with the new mediawiki code, that can produce many queries. In my opinion it is a good thing to add that information, when it is there.

Status & tagging log