r86322 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86321‎ | r86322 | r86323 >
Date:17:04, 18 April 2011
Author:demon
Status:ok
Tags:
Comment:
Per CR on r78824 (#c12467): Some query pages are useless/redundant, since we already output them elsewhere in the API, so we shouldn't expose them.
Modified paths:
  • /trunk/phase3/includes/api/ApiQueryQueryPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryQueryPage.php
@@ -37,6 +37,15 @@
3838 class ApiQueryQueryPage extends ApiQueryGeneratorBase {
3939 private $qpMap;
4040
 41+ /**
 42+ * Some query pages are useless because they're available elsewhere in the API
 43+ */
 44+ private $uselessQueryPages = array(
 45+ 'MIMEsearch', // aiprop=mime
 46+ 'LinkSearch', // list=exturlusage
 47+ 'FileDuplicateSearch', // prop=duplicatefiles
 48+ );
 49+
4150 public function __construct( $query, $moduleName ) {
4251 parent::__construct( $query, $moduleName, 'qp' );
4352 // We need to do this to make sure $wgQueryPages is set up
@@ -48,7 +57,9 @@
4958 global $wgQueryPages;
5059 $this->qpMap = array();
5160 foreach ( $wgQueryPages as $page ) {
52 - $this->qpMap[$page[1]] = $page[0];
 61+ if( !in_array( $page[1], $this->uselessQueryPages ) ) {
 62+ $this->qpMap[$page[1]] = $page[0];
 63+ }
5364 }
5465 }
5566

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r78824(bug 14869) Add API module for accessing QueryPage-based special pages. Took ...catrope20:35, 22 December 2010

Status & tagging log