Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -4714,6 +4714,16 @@ |
4715 | 4715 | } |
4716 | 4716 | |
4717 | 4717 | /** |
| 4718 | + * Accessor for $mDefaultSort |
| 4719 | + * Unlike getDefaultSort(), will return false if none is set |
| 4720 | + * |
| 4721 | + * @return string or false |
| 4722 | + */ |
| 4723 | + public function getCustomDefaultSort() { |
| 4724 | + return $this->mDefaultSort; |
| 4725 | + } |
| 4726 | + |
| 4727 | + /** |
4718 | 4728 | * Try to guess the section anchor name based on a wikitext fragment |
4719 | 4729 | * presumably extracted from a heading, for example "Header" from |
4720 | 4730 | * "== Header ==". |
Index: trunk/phase3/includes/parser/CoreParserFunctions.php |
— | — | @@ -330,9 +330,18 @@ |
331 | 331 | |
332 | 332 | public static function defaultsort( $parser, $text ) { |
333 | 333 | $text = trim( $text ); |
334 | | - if( strlen( $text ) > 0 ) |
335 | | - $parser->setDefaultSort( $text ); |
336 | | - return ''; |
| 334 | + if( strlen( $text ) == 0 ) |
| 335 | + return ''; |
| 336 | + $old = $parser->getCustomDefaultSort(); |
| 337 | + $parser->setDefaultSort( $text ); |
| 338 | + if( $old === false || $old == $text ) |
| 339 | + return ''; |
| 340 | + else |
| 341 | + return( '<span class="error">' . |
| 342 | + wfMsgForContent( 'duplicate_defaultsort', |
| 343 | + htmlspecialchars( $old ), |
| 344 | + htmlspecialchars( $text ) ) . |
| 345 | + '</span>' ); |
337 | 346 | } |
338 | 347 | |
339 | 348 | public static function filepath( $parser, $name='', $option='' ) { |
— | — | @@ -367,7 +376,7 @@ |
368 | 377 | $stripList = $parser->getStripList(); |
369 | 378 | if ( !in_array( $tagName, $stripList ) ) { |
370 | 379 | return '<span class="error">' . |
371 | | - wfMsg( 'unknown_extension_tag', $tagName ) . |
| 380 | + wfMsgForContent( 'unknown_extension_tag', $tagName ) . |
372 | 381 | '</span>'; |
373 | 382 | } |
374 | 383 | |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -3661,6 +3661,7 @@ |
3662 | 3662 | |
3663 | 3663 | # Core parser functions |
3664 | 3664 | 'unknown_extension_tag' => 'Unknown extension tag "$1"', |
| 3665 | +'duplicate_defaultsort' => 'Warning: Default sort key "$2" overrides earlier default sort key "$1".', |
3665 | 3666 | |
3666 | 3667 | # Special:Version |
3667 | 3668 | 'version' => 'Version', # Not used as normal message but as header for the special page itself |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -302,6 +302,8 @@ |
303 | 303 | * (bug 16160) Suggestions box should be resized from left for RTL wikis |
304 | 304 | * (bug 11533) Fixed insane slowdown when in read-only mode for long periods |
305 | 305 | of time with CACHE_NONE (default objectcache table configuration). |
| 306 | +* Trying to set two different default category sort keys for one page now produces |
| 307 | + a warning |
306 | 308 | |
307 | 309 | === API changes in 1.14 === |
308 | 310 | |