Index: trunk/phase3/includes/specials/SpecialRandompage.php |
— | — | @@ -10,11 +10,9 @@ |
11 | 11 | class RandomPage extends SpecialPage { |
12 | 12 | private $namespaces; // namespaces to select pages from |
13 | 13 | |
14 | | - function __construct( $name = 'Randompage' ){ |
| 14 | + public function __construct( $name = 'Randompage' ){ |
15 | 15 | global $wgContentNamespaces; |
16 | | - |
17 | 16 | $this->namespaces = $wgContentNamespaces; |
18 | | - |
19 | 17 | parent::__construct( $name ); |
20 | 18 | } |
21 | 19 | |
— | — | @@ -44,7 +42,8 @@ |
45 | 43 | |
46 | 44 | if( is_null( $title ) ) { |
47 | 45 | $this->setHeaders(); |
48 | | - $wgOut->addWikiMsg( strtolower( $this->mName ) . '-nopages', $wgContLang->getNsText( $this->namespace ) ); |
| 46 | + $wgOut->addWikiMsg( strtolower( $this->mName ) . '-nopages', |
| 47 | + $this->getNsList(), count( $this->namespaces ) ); |
49 | 48 | return; |
50 | 49 | } |
51 | 50 | |
— | — | @@ -52,7 +51,24 @@ |
53 | 52 | $wgOut->redirect( $title->getFullUrl( $query ) ); |
54 | 53 | } |
55 | 54 | |
| 55 | + /** |
| 56 | + * Get a comma-delimited list of namespaces we don't have |
| 57 | + * any pages in |
| 58 | + * @return String |
| 59 | + */ |
| 60 | + private function getNsList() { |
| 61 | + global $wgContLang; |
| 62 | + $nsNames = array(); |
| 63 | + foreach( $this->namespaces as $n ) { |
| 64 | + if( $n === NS_MAIN ) |
| 65 | + $nsNames[] = wfMsgForContent( 'blanknamespace' ); |
| 66 | + else |
| 67 | + $nsNames[] = $wgContLang->getNsText( $n ); |
| 68 | + } |
| 69 | + return $wgContLang->commaList( $nsNames ); |
| 70 | + } |
56 | 71 | |
| 72 | + |
57 | 73 | /** |
58 | 74 | * Choose a random title. |
59 | 75 | * @return Title object (or null if nothing to choose from) |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -2265,7 +2265,7 @@ |
2266 | 2266 | |
2267 | 2267 | # Random page |
2268 | 2268 | 'randompage' => 'Random page', |
2269 | | -'randompage-nopages' => 'There are no pages in the namespace "$1".', |
| 2269 | +'randompage-nopages' => 'There are no pages in the following {{PLURAL:$2|namespace|namespaces}}: $1.', |
2270 | 2270 | 'randompage-url' => 'Special:Random', # do not translate or duplicate this message to other languages |
2271 | 2271 | |
2272 | 2272 | # Random redirect |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -403,6 +403,8 @@ |
404 | 404 | foo,bar@example,com |
405 | 405 | * (bug 20176) Fix login/logout links in skin CologneBlue |
406 | 406 | * (bug 20203) "Powered by Mediawiki" now has height/width on image tag |
| 407 | +* (bug 20273) Fix broken output when no pages are found in the content |
| 408 | + namespaces |
407 | 409 | |
408 | 410 | == API changes in 1.16 == |
409 | 411 | |