Use local context instead of global variables
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 20 Aug 2011 20:12:46 +0000 (20:12 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 20 Aug 2011 20:12:46 +0000 (20:12 +0000)
includes/specials/SpecialRandompage.php

index 68a4a9b..0b6239b 100644 (file)
@@ -54,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 ) );
                }
 
@@ -64,15 +64,15 @@ class RandomPage extends SpecialPage {
 
                if( is_null( $title ) ) {
                        $this->setHeaders();
-                       $wgOut->addWikiMsg( strtolower( $this->getName() ) . '-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 ) );
        }
 
        /**