From: Kunal Mehta Date: Wed, 6 Aug 2014 15:38:27 +0000 (+0100) Subject: SpecialUploadStash: Use Config instead of globals X-Git-Tag: 1.31.0-rc.0~14572^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/?a=commitdiff_plain;h=44c08201819823d96c27f210bf83199893e5d2e6;p=lhc%2Fweb%2Fwiklou.git SpecialUploadStash: Use Config instead of globals Change-Id: I48a5838539b6aac822dd6806facbb1e8de204e4e --- diff --git a/includes/specials/SpecialUploadStash.php b/includes/specials/SpecialUploadStash.php index cb821cb3c4..b5b41766b6 100644 --- a/includes/specials/SpecialUploadStash.php +++ b/includes/specials/SpecialUploadStash.php @@ -159,15 +159,13 @@ class SpecialUploadStash extends UnlistedSpecialPage { * @return bool Success */ private function outputThumbFromStash( $file, $params ) { - // this global, if it exists, points to a "scaler", as you might find in + $flags = 0; + // this config option, if it exists, points to a "scaler", as you might find in // the Wikimedia Foundation cluster. See outputRemoteScaledThumb(). This // is part of our horrible NFS-based system, we create a file on a mount // point here, but fetch the scaled file from somewhere else that // happens to share it over NFS. - global $wgUploadStashScalerBaseUrl; - - $flags = 0; - if ( $wgUploadStashScalerBaseUrl ) { + if ( $this->getConfig()->get( 'UploadStashScalerBaseUrl' ) ) { $this->outputRemoteScaledThumb( $file, $params, $flags ); } else { $this->outputLocallyScaledThumb( $file, $params, $flags ); @@ -230,11 +228,10 @@ class SpecialUploadStash extends UnlistedSpecialPage { * @return bool Success */ private function outputRemoteScaledThumb( $file, $params, $flags ) { - // This global probably looks something like + // This option probably looks something like // 'http://upload.wikimedia.org/wikipedia/test/thumb/temp'. Do not use // trailing slash. - global $wgUploadStashScalerBaseUrl; - $scalerBaseUrl = $wgUploadStashScalerBaseUrl; + $scalerBaseUrl = $this->getConfig()->get( 'UploadStashScalerBaseUrl' ); if ( preg_match( '/^\/\//', $scalerBaseUrl ) ) { // this is apparently a protocol-relative URL, which makes no sense in this context,