From: Ian Baker Date: Mon, 25 Jul 2011 22:39:52 +0000 (+0000) Subject: Added a workaround for the lack of RequestContext in 1.17, so this code can be rolled... X-Git-Tag: 1.31.0-rc.0~28623 X-Git-Url: http://git.cyclocoop.org/%22.%24info%5B?a=commitdiff_plain;h=aa5d7bbceaa5dff843f0c56d926c3a9633c3b7d5;p=lhc%2Fweb%2Fwiklou.git Added a workaround for the lack of RequestContext in 1.17, so this code can be rolled into production. This code can be removed in 1.18+, but it'll work either way. --- diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php index ff9ddeb8c3..ff0533015b 100644 --- a/includes/api/ApiUpload.php +++ b/includes/api/ApiUpload.php @@ -220,9 +220,18 @@ class ApiUpload extends ApiBase { $this->dieUsageMsg( 'invalid-file-key' ); } - // context allows access to the current user without creating new $wgUser references - $context = $this->createContext(); - $this->mUpload = new UploadFromStash( $context->getUser() ); + if( class_exists( 'RequestContext' ) ) { + // context allows access to the current user without creating new $wgUser references + $context = $this->createContext(); + $this->mUpload = new UploadFromStash( $context->getUser() ); + } else { + // this is here to maintain 1.17 compatibility, so these changes can + // be merged into production + // remove this after we've moved to 1.18 + global $wgUser; + $this->mUpload = new UploadFromStash( $wgUser ); + } + $this->mUpload->initialize( $this->mParams['filekey'], $this->mParams['filename'] ); } elseif ( isset( $this->mParams['file'] ) ) {