Anomie has uploaded a new change for review.
https://gerrit.wikimedia.org/r/73034
Change subject: API: Allow extensions to specify "useless" query pages
......................................................................
API: Allow extensions to specify "useless" query pages
Some query pages are not useful for ApiQueryQueryPage, as they can be
better done with an existing API query. Currently, the list of such
pages is in a private static variable in ApiQueryQueryPage; this moves
it to a global so extensions can add to the list.
This also adds 'Withoutinterwiki' to the list, as that can be done with
apfilterlanglinks=withoutlanglinks.
Change-Id: Ieccd2e84803dc1de4e26cba85d6cdda13916647f
---
M RELEASE-NOTES-1.22
M includes/DefaultSettings.php
M includes/api/ApiQueryQueryPage.php
3 files changed, 15 insertions(+), 11 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/34/73034/1
diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22
index ee24a15..0228bcc 100644
--- a/RELEASE-NOTES-1.22
+++ b/RELEASE-NOTES-1.22
@@ -237,6 +237,8 @@
jobs in the job queue for link table updates of pages that use the given page
as a template. Instead, forcerecursivelinkupdate=1 is introduced and should
be used if that behaviour is desirable.
+* 'Withoutinterwiki' is no longer available to list=querypage. Use
+ list=allpages&apfilterlanglinks=withoutlanglinks instead.
=== Languages updated in 1.22===
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index f6c2a93..fd96557 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -6037,6 +6037,17 @@
$wgAPICacheHelpTimeout = 60 * 60;
/**
+ * The ApiQueryQueryPages module should skip pages that are redundant to true
+ * API queries.
+ */
+$wgAPIUselessQueryPages = array(
+ 'MIMEsearch', // aiprop=mime
+ 'LinkSearch', // list=exturlusage
+ 'FileDuplicateSearch', // prop=duplicatefiles
+ 'Withoutinterwiki', // list=allpages&apfilterlanglinks=withoutlanglinks
+);
+
+/**
* Enable AJAX framework
*/
$wgUseAjax = true;
diff --git a/includes/api/ApiQueryQueryPage.php
b/includes/api/ApiQueryQueryPage.php
index c15da1a..79fe049 100644
--- a/includes/api/ApiQueryQueryPage.php
+++ b/includes/api/ApiQueryQueryPage.php
@@ -32,15 +32,6 @@
class ApiQueryQueryPage extends ApiQueryGeneratorBase {
private $qpMap;
- /**
- * Some query pages are useless because they're available elsewhere in
the API
- */
- private $uselessQueryPages = array(
- 'MIMEsearch', // aiprop=mime
- 'LinkSearch', // list=exturlusage
- 'FileDuplicateSearch', // prop=duplicatefiles
- );
-
public function __construct( $query, $moduleName ) {
parent::__construct( $query, $moduleName, 'qp' );
// We need to do this to make sure $wgQueryPages is set up
@@ -49,10 +40,10 @@
require_once "$IP/includes/QueryPage.php";
// Build mapping from special page names to QueryPage classes
- global $wgQueryPages;
+ global $wgQueryPages, $wgAPIUselessQueryPages;
$this->qpMap = array();
foreach ( $wgQueryPages as $page ) {
- if ( !in_array( $page[1], $this->uselessQueryPages ) ) {
+ if ( !in_array( $page[1], $wgAPIUselessQueryPages ) ) {
$this->qpMap[$page[1]] = $page[0];
}
}
--
To view, visit https://gerrit.wikimedia.org/r/73034
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ieccd2e84803dc1de4e26cba85d6cdda13916647f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits