jenkins-bot has submitted this change and it was merged.
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 require
arguments that cannot be specified with that interface. 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.
Change-Id: Ieccd2e84803dc1de4e26cba85d6cdda13916647f
---
M RELEASE-NOTES-1.22
M includes/DefaultSettings.php
M includes/api/ApiQueryQueryPage.php
3 files changed, 14 insertions(+), 11 deletions(-)
Approvals:
Kaldari: Looks good to me, approved
jenkins-bot: Verified
diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22
index 1766d9f..858a6f3 100644
--- a/RELEASE-NOTES-1.22
+++ b/RELEASE-NOTES-1.22
@@ -204,6 +204,8 @@
* Handle relative inclusions ({{../name}}) in main namespace with subpages
enabled correctly (previously MediaWiki tried to include Template:Parent/name
instead of just Parent/name).
+* Added $wgAPIUselessQueryPages to allow extensions to flag their query pages
+ for non-inclusion in ApiQueryQueryPages.
=== API changes in 1.22 ===
* (bug 25553) The JSON output formatter now leaves forward slashes unescaped
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 1f5b2f7..15f6987 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -6035,6 +6035,16 @@
$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
+);
+
+/**
* 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: merged
Gerrit-Change-Id: Ieccd2e84803dc1de4e26cba85d6cdda13916647f
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: Brian Wolff <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits