r85293 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85292‎ | r85293 | r85294 >
Date:23:08, 3 April 2011
Author:happy-melon
Status:ok
Tags:
Comment:
Clean out some globals from SpecialPage.php
Modified paths:
  • /trunk/phase3/includes/SpecialPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialPage.php
@@ -523,8 +523,7 @@
524524 * @param $context RequestContext
525525 * @param $including Bool output is being captured for use in {{special:whatever}}
526526 */
527 - static function executePath( &$title, RequestContext $context, $including = false ) {
528 - global $wgOut, $wgTitle, $wgRequest;
 527+ public static function executePath( &$title, RequestContext &$context, $including = false ) {
529528 wfProfileIn( __METHOD__ );
530529
531530 # FIXME: redirects broken due to this call
@@ -538,10 +537,10 @@
539538 $page = SpecialPage::getPageByAlias( $name );
540539 # Nonexistent?
541540 if ( !$page ) {
542 - $wgOut->setArticleRelated( false );
543 - $wgOut->setRobotPolicy( 'noindex,nofollow' );
544 - $wgOut->setStatusCode( 404 );
545 - $wgOut->showErrorPage( 'nosuchspecialpage', 'nospecialpagetext' );
 541+ $context->output->setArticleRelated( false );
 542+ $context->output->setRobotPolicy( 'noindex,nofollow' );
 543+ $context->output->setStatusCode( 404 );
 544+ $context->output->showErrorPage( 'nosuchspecialpage', 'nospecialpagetext' );
546545 wfProfileOut( __METHOD__ );
547546 return false;
548547 }
@@ -555,13 +554,13 @@
556555 $query = $page->getRedirectQuery();
557556 if ( $redirect instanceof Title ) {
558557 $url = $redirect->getFullUrl( $query );
559 - $wgOut->redirect( $url );
 558+ $context->output->redirect( $url );
560559 wfProfileOut( __METHOD__ );
561560 return $redirect;
562561 } elseif( $redirect === true ) {
563562 global $wgScript;
564563 $url = $wgScript . '?' . wfArrayToCGI( $query );
565 - $wgOut->redirect( $url );
 564+ $context->output->redirect( $url );
566565 wfProfileOut( __METHOD__ );
567566 return $redirect;
568567 }
@@ -572,13 +571,13 @@
573572 # the request. Such POST requests are possible for old extensions that
574573 # generate self-links without being aware that their default name has
575574 # changed.
576 - if ( !$including && $name != $page->getLocalName() && !$wgRequest->wasPosted() ) {
 575+ if ( !$including && $name != $page->getLocalName() && !$context->request->wasPosted() ) {
577576 $query = $_GET;
578577 unset( $query['title'] );
579578 $query = wfArrayToCGI( $query );
580579 $title = $page->getTitle( $par );
581580 $url = $title->getFullUrl( $query );
582 - $wgOut->redirect( $url );
 581+ $context->output->redirect( $url );
583582 wfProfileOut( __METHOD__ );
584583 return $redirect;
585584 }
@@ -587,7 +586,7 @@
588587 wfProfileOut( __METHOD__ );
589588 return false;
590589 } elseif ( !$including ) {
591 - $wgTitle = $page->getTitle();
 590+ $context->title = $page->getTitle();
592591 }
593592 $page->including( $including );
594593
@@ -608,7 +607,7 @@
609608 * @return String: HTML fragment
610609 */
611610 static function capturePath( &$title ) {
612 - global $wgOut, $wgTitle, $wgUser;
 611+ global $wgOut, $wgTitle;
613612
614613 // preload the skin - Sometimes the SpecialPage loads it at a bad point in time making a includable special page override the skin title
615614 // This hack is ok for now. The plan is for
@@ -962,12 +961,11 @@
963962 * @return String
964963 */
965964 function getRedirectQuery() {
966 - global $wgRequest;
967965 $params = array();
968966
969967 foreach( $this->mAllowedRedirectParams as $arg ) {
970 - if( $wgRequest->getVal( $arg, null ) !== null ){
971 - $params[$arg] = $wgRequest->getVal( $arg );
 968+ if( $this->getContext()->request->getVal( $arg, null ) !== null ){
 969+ $params[$arg] = $this->getContext()->request->getVal( $arg );
972970 }
973971 }
974972

Status & tagging log