Fix namespace handling for uncategorized-categories-exceptionlist
authorUmherirrender <umherirrender_de.wp@web.de>
Fri, 13 Jan 2017 18:30:51 +0000 (19:30 +0100)
committerUmherirrender <umherirrender_de.wp@web.de>
Fri, 13 Jan 2017 18:32:11 +0000 (19:32 +0100)
Some categories have a namespace at begin, which is not handled correct
when just using Title::newFromText

Change-Id: I7e12b66028a8e8292473e3a58e2b271c7f3a2274

includes/specials/SpecialUncategorizedcategories.php

index 7c3265d..90dfdc5 100644 (file)
@@ -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();
                                }