Check for the namespace correctly in Special:Allmessages
authorAmir E. Aharoni <amir.aharoni@mail.huji.ac.il>
Fri, 2 May 2014 11:31:09 +0000 (13:31 +0200)
committerAmir E. Aharoni <amir.aharoni@mail.huji.ac.il>
Fri, 2 May 2014 12:10:15 +0000 (14:10 +0200)
This is a followup to I21a6d4359faf9d86ce3b01e423e8c3ab4c02658f

It fixes an error there, which causes a lot of messages
not to appear.

This checks for the namespace of the page correctly.

Change-Id: I63a34a4d674454edf9627a5893ef9dd15643f927

includes/specials/SpecialAllmessages.php

index 33c92b5..687cbd0 100644 (file)
@@ -272,19 +272,23 @@ class AllmessagesTablePager extends TablePager {
 
                foreach ( $res as $s ) {
                        $exists = false;
+
                        if ( $foreign ) {
-                               $title = explode( '/', $s->page_title );
-                               if ( count( $title ) === 2 && $langcode === $title[1]
-                                       && isset( $xNames[$title[0]] )
+                               $titleParts = explode( '/', $s->page_title );
+                               if ( count( $titleParts ) === 2 &&
+                                       $langcode === $titleParts[1] &&
+                                       isset( $xNames[$titleParts[0]] )
                                ) {
-                                       $exists = $title[0];
+                                       $exists = $titleParts[0];
                                }
                        } elseif ( isset( $xNames[$s->page_title] ) ) {
                                $exists = $s->page_title;
                        }
-                       if ( $exists && $s->page_namespace === NS_MEDIAWIKI ) {
+
+                       $title = Title::newFromRow( $s );
+                       if ( $exists && $title->inNamespace( NS_MEDIAWIKI ) ) {
                                $pageFlags[$exists] = true;
-                       } elseif ( $exists && $s->page_namespace === NS_MEDIAWIKI_TALK ) {
+                       } elseif ( $exists && $title->inNamespace( NS_MEDIAWIKI_TALK ) ) {
                                $talkFlags[$exists] = true;
                        }
                }