X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialUploadStash.php;h=ddb435d95b4e355d54c0553c0b41a73dce9a31f7;hb=9a83edf6a27638cfe55924a4baf0a3081bf45e6f;hp=cb821cb3c48853f3b7ad8375eb1d8f8688ae4155;hpb=9876ee1a2c3c85e2f083ff84acbf767865ae8620;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialUploadStash.php b/includes/specials/SpecialUploadStash.php index cb821cb3c4..ddb435d95b 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 ); @@ -199,8 +197,8 @@ class SpecialUploadStash extends UnlistedSpecialPage { throw new UploadStashFileNotFoundException( "no local path for scaled item" ); } - // now we should construct a File, so we can get mime and other such info in a standard way - // n.b. mimetype may be different from original (ogx original -> jpeg thumb) + // now we should construct a File, so we can get MIME and other such info in a standard way + // n.b. MIME type may be different from original (ogx original -> jpeg thumb) $thumbFile = new UnregisteredLocalFile( false, $this->stash->repo, $thumbnailImage->getStoragePath(), false ); if ( !$thumbFile ) { @@ -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, @@ -295,7 +292,7 @@ class SpecialUploadStash extends UnlistedSpecialPage { * Output HTTP response of raw content * Side effect: writes HTTP response to STDOUT. * @param string $content Content - * @param string $contentType Mime type + * @param string $contentType MIME type * @throws SpecialUploadStashTooLargeException * @return bool */ @@ -313,7 +310,7 @@ class SpecialUploadStash extends UnlistedSpecialPage { /** * Output headers for streaming * @todo Unsure about encoding as binary; if we received from HTTP perhaps - * we should use that encoding, concatted with semicolon to mimeType as it + * we should use that encoding, concatenated with semicolon to `$contentType` as it * usually is. * Side effect: preps PHP to write headers to STDOUT. * @param string $contentType String suitable for content-type header