X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialRandompage.php;h=307088ed3503709f34c8374bafe4046cd6db99be;hb=5787cbc7d7aad5336522e21afa58953b6a7faecd;hp=fecd355ad4c5ab24a26cacb7d664a3df32dbd687;hpb=6826aed67097ded0c9a2366920009505f10a528c;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialRandompage.php b/includes/specials/SpecialRandompage.php index fecd355ad4..307088ed35 100644 --- a/includes/specials/SpecialRandompage.php +++ b/includes/specials/SpecialRandompage.php @@ -33,8 +33,7 @@ class RandomPage extends SpecialPage { protected $extra = array(); // Extra SQL statements public function __construct( $name = 'Randompage' ){ - global $wgContentNamespaces; - $this->namespaces = $wgContentNamespaces; + $this->namespaces = MWNamespace::getContentNamespaces(); parent::__construct( $name ); } @@ -55,9 +54,9 @@ class RandomPage extends SpecialPage { } public function execute( $par ) { - global $wgOut, $wgContLang, $wgRequest; + global $wgContLang; - if ($par) { + if ( $par ) { $this->setNamespace( $wgContLang->getNsIndex( $par ) ); } @@ -65,15 +64,15 @@ class RandomPage extends SpecialPage { if( is_null( $title ) ) { $this->setHeaders(); - $wgOut->addWikiMsg( strtolower( $this->mName ) . '-nopages', + $this->getOutput()->addWikiMsg( strtolower( $this->getName() ) . '-nopages', $this->getNsList(), count( $this->namespaces ) ); return; } $redirectParam = $this->isRedirect() ? array( 'redirect' => 'no' ) : array(); - $query = array_merge( $wgRequest->getValues(), $redirectParam ); + $query = array_merge( $this->getRequest()->getValues(), $redirectParam ); unset( $query['title'] ); - $wgOut->redirect( $title->getFullUrl( $query ) ); + $this->getOutput()->redirect( $title->getFullUrl( $query ) ); } /** @@ -86,7 +85,7 @@ class RandomPage extends SpecialPage { $nsNames = array(); foreach( $this->namespaces as $n ) { if( $n === NS_MAIN ) { - $nsNames[] = wfMsgForContent( 'blanknamespace' ); + $nsNames[] = $this->msg( 'blanknamespace' )->plain(); } else { $nsNames[] = $wgContLang->getNsText( $n ); } @@ -126,16 +125,8 @@ class RandomPage extends SpecialPage { } protected function getQueryInfo( $randstr ) { - global $wgExtraRandompageSQL; $redirect = $this->isRedirect() ? 1 : 0; - if ( $wgExtraRandompageSQL ) { - $this->extra[] = $wgExtraRandompageSQL; - } - if ( $this->addExtraSQL() ) { - $this->extra[] = $this->addExtraSQL(); - } - return array( 'tables' => array( 'page' ), 'fields' => array( 'page_title', 'page_namespace' ), @@ -168,12 +159,4 @@ class RandomPage extends SpecialPage { return $dbr->fetchObject( $res ); } - - /* an alternative to $wgExtraRandompageSQL so subclasses - * can add their own SQL by overriding this function - * @deprecated, append to $this->extra instead - */ - public function addExtraSQL() { - return ''; - } }