Florianschmidtwelzow has uploaded a new change for review.
https://gerrit.wikimedia.org/r/280507
Change subject: Allow to define exceptions for Special:UncategorizedCategories
on-wiki
......................................................................
Allow to define exceptions for Special:UncategorizedCategories on-wiki
The new system message uncategorized-categories-exceptionlist can be changed
on-wiki to hold a list of categories, that shouldn't be visible on the special
page Special:UncategorizedCategories (with or without a trailing "* "), even if
these categories aren't in any category.
Bug: T126117
Change-Id: I65989e40f3caa2fad7b8b35109c0466e01084f72
---
M includes/specials/SpecialUncategorizedcategories.php
1 file changed, 30 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/07/280507/1
diff --git a/includes/specials/SpecialUncategorizedcategories.php
b/includes/specials/SpecialUncategorizedcategories.php
index 1cc40a9..621c711 100644
--- a/includes/specials/SpecialUncategorizedcategories.php
+++ b/includes/specials/SpecialUncategorizedcategories.php
@@ -27,12 +27,42 @@
* @ingroup SpecialPage
*/
class UncategorizedCategoriesPage extends UncategorizedPagesPage {
+ /**
+ * Holds a list of categories, which shouldn't be listed on this
special page,
+ * even if it is uncategorized.
+ * @var array
+ */
+ private $exceptionList = null;
+
function __construct( $name = 'Uncategorizedcategories' ) {
parent::__construct( $name );
$this->requestedNamespace = NS_CATEGORY;
}
/**
+ * Returns an array of categorie titles (usually without the
namespace), which
+ * shouldn't be listed on this page, even if they're uncategorized.
+ *
+ * @return array
+ */
+ private function getExceptionList() {
+ if ( $this->exceptionList === null ) {
+ $exList = $this->msg(
'uncategorized-categories-exceptionlist' )
+ ->inContentLanguage()->plain();
+ $this->exceptionList = explode( "\n", str_replace( '*
', '', $exList ) );
+ }
+ return $this->exceptionList;
+ }
+
+ public function getQueryInfo() {
+ $dbr = wfGetDB( DB_SLAVE );
+ $query = parent::getQueryInfo();
+ $query['conds'][] = 'page_title not in ( ' . $dbr->makeList(
$this->getExceptionList() ) . ' )';
+
+ return $query;
+ }
+
+ /**
* Formats the result
* @param Skin $skin The current skin
* @param object $result The query result
--
To view, visit https://gerrit.wikimedia.org/r/280507
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I65989e40f3caa2fad7b8b35109c0466e01084f72
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits