r98067 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98066‎ | r98067 | r98068 >
Date:16:32, 25 September 2011
Author:robin
Status:ok (Comments)
Tags:
Comment:
Talk page links were bluelinks if the root page existed instead of the subpage (i.e. a link to MediaWiki talk:Xyz/nl was blue if MediaWiki talk:Xyz existed). This is present in at least MW 1.16 - now.
Modified paths:
  • /trunk/phase3/includes/specials/SpecialAllmessages.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialAllmessages.php
@@ -249,6 +249,7 @@
250250 * @param array $messageNames
251251 * @param string $langcode What language code
252252 * @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
253254 */
254255 public static function getCustomisedStatuses( $messageNames, $langcode = 'en', $foreign = false ) {
255256 // FIXME: This function should be moved to Language:: or something.
@@ -266,19 +267,21 @@
267268 $pageFlags = $talkFlags = array();
268269
269270 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];
279277 }
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;
282280 }
 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+ }
283286 }
284287
285288 wfProfileOut( __METHOD__ . '-db' );

Comments

#Comment by Krinkle (talk | contribs)   21:40, 25 September 2011

Commit message says how things were in 1.16 - now. Was that wrong ? Why ? What was it changed to ? Without that information, it's hard to evaluate whether the commit is broken or not.

In general, links to NS_MEDIAWIKI should almost always be blue, unless the message does not exist anywhere (core or on-wiki). Afaik if "MediaWiki:Foo" is created, then requesting {{int:foo}} or wfMsg() in a dutch language will work. So it may not be that wrong to have a link to MediaWiki:Foo/nl link be blue if it does not exist. (After all, if MediaWiki:Foo and MediaWiki:Foo/* don't exist at all but that message is defined in PHP, then a link to MediaWiki:Foo or MediaWiki:Foo/nl is and should be blue as well.

#Comment by SPQRobin (talk | contribs)   14:52, 26 September 2011

It's about links to MediaWiki_talk, not MediaWiki. As you can see on Special:Allmessages/nl, all links are red. If you look at http://www.mediawiki.org/w/index.php?title=Special%3AAllMessages&prefix=captchahelp&lang=nl&limit=80 you'll see that the bluelink links to MediaWiki talk:Captchahelp-text/nl which does not exist. It is blue because MediaWiki talk:Captchahelp-text exists.

#Comment by Nikerabbit (talk | contribs)   15:11, 26 September 2011

/me never understood why need to hack non-existing makes pages to look like they exist.

#Comment by 😂 (talk | contribs)   13:36, 5 December 2011

Because people like blue instead of red?

#Comment by SPQRobin (talk | contribs)   13:38, 5 December 2011

FYI, this code has nothing to do with making non-existing pages appear blue. Existing ones are rendered with blue links, non-existing ones with red links.

#Comment by SPQRobin (talk | contribs)   16:31, 5 December 2011

Hashar, why did you mark this revision as fixme?

#Comment by SPQRobin (talk | contribs)   23:35, 9 December 2011

Resetting to new.

Status & tagging log