/**
* Execute page -- can output a file directly or show a listing of them.
*
- * @param string $subPage subpage, e.g. in
+ * @param string $subPage Subpage, e.g. in
* http://example.com/wiki/Special:UploadStash/foo.jpg, the "foo.jpg" part
* @return bool Success
*/
* If file available in stash, cats it out to the client as a simple HTTP response.
* n.b. Most sanity checking done in UploadStashLocalFile, so this is straightforward.
*
- * @param string $key the key of a particular requested file
+ * @param string $key The key of a particular requested file
* @throws HttpError
* @return bool
*/
* @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 );
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 ) {
* @param array $params Scaling parameters ( e.g. array( width => '50' ) );
* @param int $flags Scaling flags ( see File:: constants )
* @throws MWException
- * @return bool success
+ * @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,
* 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
*/
/**
* 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