Index: trunk/phase3/includes/specials/SpecialAllmessages.php |
— | — | @@ -249,6 +249,7 @@ |
250 | 250 | * @param array $messageNames |
251 | 251 | * @param string $langcode What language code |
252 | 252 | * @param bool $foreign Whether the $langcode is not the content language |
| 253 | + * @return array: a 'pages' and 'talks' array with the keys of existing pages |
253 | 254 | */ |
254 | 255 | public static function getCustomisedStatuses( $messageNames, $langcode = 'en', $foreign = false ) { |
255 | 256 | // FIXME: This function should be moved to Language:: or something. |
— | — | @@ -266,19 +267,21 @@ |
267 | 268 | $pageFlags = $talkFlags = array(); |
268 | 269 | |
269 | 270 | foreach ( $res as $s ) { |
270 | | - if( $s->page_namespace == NS_MEDIAWIKI ) { |
271 | | - if( $foreign ) { |
272 | | - $title = explode( '/', $s->page_title ); |
273 | | - if( count( $title ) === 2 && $langcode == $title[1] |
274 | | - && isset( $xNames[$title[0]] ) ) { |
275 | | - $pageFlags["{$title[0]}"] = true; |
276 | | - } |
277 | | - } elseif( isset( $xNames[$s->page_title] ) ) { |
278 | | - $pageFlags[$s->page_title] = true; |
| 271 | + $exists = false; |
| 272 | + if( $foreign ) { |
| 273 | + $title = explode( '/', $s->page_title ); |
| 274 | + if( count( $title ) === 2 && $langcode == $title[1] |
| 275 | + && isset( $xNames[$title[0]] ) ) { |
| 276 | + $exists = $title[0]; |
279 | 277 | } |
280 | | - } elseif( $s->page_namespace == NS_MEDIAWIKI_TALK ){ |
281 | | - $talkFlags[$s->page_title] = true; |
| 278 | + } elseif( isset( $xNames[$s->page_title] ) ) { |
| 279 | + $exists = $s->page_title; |
282 | 280 | } |
| 281 | + if( $exists && $s->page_namespace == NS_MEDIAWIKI ) { |
| 282 | + $pageFlags[$exists] = true; |
| 283 | + } elseif( $exists && $s->page_namespace == NS_MEDIAWIKI_TALK ) { |
| 284 | + $talkFlags[$exists] = true; |
| 285 | + } |
283 | 286 | } |
284 | 287 | |
285 | 288 | wfProfileOut( __METHOD__ . '-db' ); |