r95324 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95323‎ | r95324 | r95325 >
Date:19:48, 23 August 2011
Author:ialex
Status:ok
Tags:
Comment:
Use local context instead of global variables
Modified paths:
  • /trunk/phase3/includes/specials/SpecialFilepath.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialFilepath.php
@@ -33,12 +33,11 @@
3434 }
3535
3636 function execute( $par ) {
37 - global $wgRequest, $wgOut;
38 -
3937 $this->setHeaders();
4038 $this->outputHeader();
4139
42 - $file = !is_null( $par ) ? $par : $wgRequest->getText( 'file' );
 40+ $request = $this->getRequest();
 41+ $file = !is_null( $par ) ? $par : $request->getText( 'file' );
4342
4443 $title = Title::makeTitleSafe( NS_FILE, $file );
4544
@@ -50,8 +49,8 @@
5150 if ( $file && $file->exists() ) {
5251 // Default behaviour: Use the direct link to the file.
5352 $url = $file->getURL();
54 - $width = $wgRequest->getInt( 'width', -1 );
55 - $height = $wgRequest->getInt( 'height', -1 );
 53+ $width = $request->getInt( 'width', -1 );
 54+ $height = $request->getInt( 'height', -1 );
5655
5756 // If a width is requested...
5857 if ( $width != -1 ) {
@@ -62,9 +61,9 @@
6362 $url = $mto->getURL();
6463 }
6564 }
66 - $wgOut->redirect( $url );
 65+ $this->getOutput()->redirect( $url );
6766 } else {
68 - $wgOut->setStatusCode( 404 );
 67+ $this->getOutput()->setStatusCode( 404 );
6968 $this->showForm( $title );
7069 }
7170 }
@@ -74,9 +73,9 @@
7574 * @param $title Title
7675 */
7776 function showForm( $title ) {
78 - global $wgOut, $wgScript;
 77+ global $wgScript;
7978
80 - $wgOut->addHTML(
 79+ $this->getOutput()->addHTML(
8180 Html::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'id' => 'specialfilepath' ) ) .
8281 Html::openElement( 'fieldset' ) .
8382 Html::element( 'legend', null, wfMsg( 'filepath' ) ) .

Status & tagging log