dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Avoid @backupGlobals in ExtensionRegistryTest"
[lhc/web/wiklou.git]
/
includes
/
specials
/
SpecialRandompage.php
diff --git
a/includes/specials/SpecialRandompage.php
b/includes/specials/SpecialRandompage.php
index
e4f31f4
..
73a88b9
100644
(file)
--- a/
includes/specials/SpecialRandompage.php
+++ b/
includes/specials/SpecialRandompage.php
@@
-56,7
+56,9
@@
class RandomPage extends SpecialPage {
public function execute( $par ) {
global $wgContLang;
public function execute( $par ) {
global $wgContLang;
- if ( $par ) {
+ if ( is_string( $par ) ) {
+ // Testing for stringiness since we want to catch
+ // the empty string to mean main namespace only.
$this->setNamespace( $wgContLang->getNsIndex( $par ) );
}
$this->setNamespace( $wgContLang->getNsIndex( $par ) );
}
@@
-64,6
+66,7
@@
class RandomPage extends SpecialPage {
if ( is_null( $title ) ) {
$this->setHeaders();
if ( is_null( $title ) ) {
$this->setHeaders();
+ // Message: randompage-nopages, randomredirect-nopages
$this->getOutput()->addWikiMsg( strtolower( $this->getName() ) . '-nopages',
$this->getNsList(), count( $this->namespaces ) );
$this->getOutput()->addWikiMsg( strtolower( $this->getName() ) . '-nopages',
$this->getNsList(), count( $this->namespaces ) );
@@
-79,7
+82,7
@@
class RandomPage extends SpecialPage {
/**
* Get a comma-delimited list of namespaces we don't have
* any pages in
/**
* Get a comma-delimited list of namespaces we don't have
* any pages in
- * @return
S
tring
+ * @return
s
tring
*/
private function getNsList() {
global $wgContLang;
*/
private function getNsList() {
global $wgContLang;
@@
-97,13
+100,13
@@
class RandomPage extends SpecialPage {
/**
* Choose a random title.
/**
* Choose a random title.
- * @return Title object (or null if nothing to choose from)
+ * @return Title
|null Title
object (or null if nothing to choose from)
*/
public function getRandomTitle() {
$randstr = wfRandom();
$title = null;
*/
public function getRandomTitle() {
$randstr = wfRandom();
$title = null;
- if ( !
wfRunHooks
(
+ if ( !
Hooks::run
(
'SpecialRandomGetRandomTitle',
array( &$randstr, &$this->isRedir, &$this->namespaces, &$this->extra, &$title )
) ) {
'SpecialRandomGetRandomTitle',
array( &$randstr, &$this->isRedir, &$this->namespaces, &$this->extra, &$title )
) ) {
@@
-143,7
+146,6
@@
class RandomPage extends SpecialPage {
), $this->extra ),
'options' => array(
'ORDER BY' => 'page_random',
), $this->extra ),
'options' => array(
'ORDER BY' => 'page_random',
- 'USE INDEX' => 'page_random',
'LIMIT' => 1,
),
'join_conds' => array()
'LIMIT' => 1,
),
'join_conds' => array()