Jdlrobson has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/368325 )

Change subject: Allow blacklisting certain namespaces in Special:ShortPages
......................................................................

Allow blacklisting certain namespaces in Special:ShortPages

This new config variable ($wgShortPagesNamespaceBlacklist)
allows wikis to specify namespaces which should be excluded from
Special:ShortPages.

This will be used by Commons, for which NS_FILE is a content namespace
(accessible via Special:Random and Special:Nearby) but is not useful
to list on Special:ShortPages.

If the blacklist cancels out all namespace in wgContentNamespaces then
all namespaces will show up on the page.

Bug: T170687
Change-Id: I10b4849a5d7f3f8af75ccc6cfba230d03725c898
---
M includes/DefaultSettings.php
M includes/specials/SpecialShortpages.php
2 files changed, 11 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/25/368325/1

diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 74d5fa4..2fcf6ad 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -4089,7 +4089,14 @@
  * contain "content" which should be considered when generating a count of the
  * number of articles in the wiki.
  */
-$wgContentNamespaces = [ NS_MAIN ];
+$wgContentNamespaces = [];
+
+/**
+ * Optional array of namespaces which should be blacklisted from 
Special:ShortPages
+ * Only pages inside $wgContentNamespaces but not 
$wgShortPagesNamespaceBlacklist will
+ * be shown on that page.
+ */
+$wgShortPagesNamespaceBlacklist = [];
 
 /**
  * Array of namespaces, in addition to the talk namespaces, where signatures
diff --git a/includes/specials/SpecialShortpages.php 
b/includes/specials/SpecialShortpages.php
index f980e71..e9c15e7 100644
--- a/includes/specials/SpecialShortpages.php
+++ b/includes/specials/SpecialShortpages.php
@@ -41,9 +41,11 @@
        }
 
        public function getQueryInfo() {
+               $config = $this->getConfig();
+               $blacklist = $config->get( 'ShortPagesNamespaceBlacklist' );
                $tables = [ 'page' ];
                $conds = [
-                       'page_namespace' => MWNamespace::getContentNamespaces(),
+                       'page_namespace' => array_diff( 
MWNamespace::getContentNamespaces(), $blacklist ),
                        'page_is_redirect' => 0
                ];
                $joinConds = [];

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I10b4849a5d7f3f8af75ccc6cfba230d03725c898
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to