Kaldari has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/262680

Change subject: Add hook to allow extensions to modify query used by 
Special:ShortPages
......................................................................

Add hook to allow extensions to modify query used by Special:ShortPages

Change-Id: I9ac910bc4c24196b1f19e2fc7f1e5b88a0dac41b
---
M docs/hooks.txt
M includes/specials/SpecialShortpages.php
2 files changed, 19 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/80/262680/1

diff --git a/docs/hooks.txt b/docs/hooks.txt
index fe88fa7..7c21d43 100644
--- a/docs/hooks.txt
+++ b/docs/hooks.txt
@@ -2568,6 +2568,12 @@
 
 'SetupAfterCache': Called in Setup.php, after cache objects are set
 
+'ShortPagesQuery': Allow extensions to modify the query used by
+Special:ShortPages.
+&$tables: tables to join in the query
+&$conds: conditions for the query
+&$joinConds: join conditions for the query
+
 'ShowMissingArticle': Called when generating the output for a non-existent 
page.
 $article: The article object corresponding to the page
 
diff --git a/includes/specials/SpecialShortpages.php 
b/includes/specials/SpecialShortpages.php
index ba11862..1277860 100644
--- a/includes/specials/SpecialShortpages.php
+++ b/includes/specials/SpecialShortpages.php
@@ -38,17 +38,25 @@
        }
 
        public function getQueryInfo() {
+               $tables = array( 'page' );
+               $conds = array(
+                       'page_namespace' => MWNamespace::getContentNamespaces(),
+                       'page_is_redirect' => 0
+               );
+               $joinConds = array();
+
+               // Allow extensions to modify the query
+               Hooks::run( 'ShortPagesQuery', array( &$tables, &$conds, 
&$joinConds ) );
+
                return array(
-                       'tables' => array( 'page' ),
+                       'tables' => $tables,
                        'fields' => array(
                                'namespace' => 'page_namespace',
                                'title' => 'page_title',
                                'value' => 'page_len'
                        ),
-                       'conds' => array(
-                               'page_namespace' => 
MWNamespace::getContentNamespaces(),
-                               'page_is_redirect' => 0
-                       ),
+                       'conds' => $conds,
+                       'join_conds' => $joinConds,
                        'options' => array( 'USE INDEX' => 
'page_redirect_namespace_len' )
                );
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/262680
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9ac910bc4c24196b1f19e2fc7f1e5b88a0dac41b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Kaldari <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to