r105831 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105830‎ | r105831 | r105832 >
Date:21:07, 11 December 2011
Author:reedy
Status:reverted (Comments)
Tags:
Comment:
Make ApiQueryBase::addTitleInfo() add the pageid also
Modified paths:
  • /trunk/phase3/includes/api/ApiQueryBase.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryBase.php
@@ -296,7 +296,7 @@
297297 }
298298
299299 /**
300 - * Add information (title and namespace) about a Title object to a
 300+ * Add information (title, ID and namespace) about a Title object to a
301301 * result array
302302 * @param $arr array Result array à la ApiResult
303303 * @param $title Title
@@ -304,6 +304,7 @@
305305 */
306306 public static function addTitleInfo( &$arr, $title, $prefix = '' ) {
307307 $arr[$prefix . 'ns'] = intval( $title->getNamespace() );
 308+ $arr[$prefix . 'pageid'] = $title->getArticleID();
308309 $arr[$prefix . 'title'] = $title->getPrefixedText();
309310 }
310311

Follow-up revisions

RevisionCommit summaryAuthorDate
r106523Per bug 28901, and Duplicatebug on r105831, only list the Article ID if it ha...reedy19:55, 17 December 2011
r106868Provisional revert of r105831: as noted it's not safe; alternative fix was a ...brion21:37, 20 December 2011

Comments

#Comment by Duplicatebug (talk | contribs)   18:27, 17 December 2011

This does not work very well with all modules, which are using this function. For example list=allimages. Maybe set the pageid only, when it is set in $title or add LinkBatches to that module or change the query to join the page table also for grapping the pageid.

Please check all modules to avoid hugh load on the server.

See also bug 28901

#Comment by Reedy (talk | contribs)   19:56, 17 December 2011

Thanks for the point. Forgot about bug 28901, worked around with a short-term fix in r106523, until I've got the time to fixup the callers too

#Comment by Brion VIBBER (talk | contribs)   21:37, 20 December 2011

Reverted in r106868, along with r106523 which seems very weird. An abstraction violation, and leaves you not knowing ahead of time whether anything will or won't include this data.

Status & tagging log