From b27aceb218dfd760e5cc34265739e85a38b82e17 Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Fri, 13 Jan 2017 19:30:51 +0100 Subject: [PATCH] Fix namespace handling for uncategorized-categories-exceptionlist Some categories have a namespace at begin, which is not handled correct when just using Title::newFromText Change-Id: I7e12b66028a8e8292473e3a58e2b271c7f3a2274 --- includes/specials/SpecialUncategorizedcategories.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/includes/specials/SpecialUncategorizedcategories.php b/includes/specials/SpecialUncategorizedcategories.php index 7c3265d625..90dfdc57bd 100644 --- a/includes/specials/SpecialUncategorizedcategories.php +++ b/includes/specials/SpecialUncategorizedcategories.php @@ -50,12 +50,15 @@ class UncategorizedCategoriesPage extends UncategorizedPagesPage { $exList = $this->msg( 'uncategorized-categories-exceptionlist' ) ->inContentLanguage()->plain(); $proposedTitles = explode( "\n", $exList ); - foreach ( $proposedTitles as $count => $title ) { - if ( strpos( $title, '*' ) !== 0 ) { + foreach ( $proposedTitles as $count => $titleStr ) { + if ( strpos( $titleStr, '*' ) !== 0 ) { continue; } - $title = preg_replace( "/^\\*\\s*/", '', $title ); - $title = Title::newFromText( $title, NS_CATEGORY ); + $titleStr = preg_replace( "/^\\*\\s*/", '', $titleStr ); + $title = Title::newFromText( $titleStr, NS_CATEGORY ); + if ( $title && $title->getNamespace() !== NS_CATEGORY ) { + $title = Title::makeTitleSafe( NS_CATEGORY, $titleStr ); + } if ( $title ) { $this->exceptionList[] = $title->getDBKey(); } -- 2.20.1