Merge "Perform a permission check on the title when changing the page language"
[lhc/web/wiklou.git] / includes / specials / SpecialUncategorizedcategories.php
index 7c3265d..5ff9e04 100644 (file)
@@ -40,7 +40,7 @@ class UncategorizedCategoriesPage extends UncategorizedPagesPage {
        }
 
        /**
-        * Returns an array of categorie titles (usually without the namespace), which
+        * Returns an array of category titles (usually without the namespace), which
         * shouldn't be listed on this page, even if they're uncategorized.
         *
         * @return array
@@ -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();
                                }
@@ -65,7 +68,7 @@ class UncategorizedCategoriesPage extends UncategorizedPagesPage {
        }
 
        public function getQueryInfo() {
-               $dbr = wfGetDB( DB_SLAVE );
+               $dbr = wfGetDB( DB_REPLICA );
                $query = parent::getQueryInfo();
                $exceptionList = $this->getExceptionList();
                if ( $exceptionList ) {