Index: trunk/phase3/includes/api/ApiUpload.php |
— | — | @@ -220,9 +220,18 @@ |
221 | 221 | $this->dieUsageMsg( 'invalid-file-key' ); |
222 | 222 | } |
223 | 223 | |
224 | | - // context allows access to the current user without creating new $wgUser references |
225 | | - $context = $this->createContext(); |
226 | | - $this->mUpload = new UploadFromStash( $context->getUser() ); |
| 224 | + if( class_exists( 'RequestContext' ) ) { |
| 225 | + // context allows access to the current user without creating new $wgUser references |
| 226 | + $context = $this->createContext(); |
| 227 | + $this->mUpload = new UploadFromStash( $context->getUser() ); |
| 228 | + } else { |
| 229 | + // this is here to maintain 1.17 compatibility, so these changes can |
| 230 | + // be merged into production |
| 231 | + // remove this after we've moved to 1.18 |
| 232 | + global $wgUser; |
| 233 | + $this->mUpload = new UploadFromStash( $wgUser ); |
| 234 | + } |
| 235 | + |
227 | 236 | $this->mUpload->initialize( $this->mParams['filekey'], $this->mParams['filename'] ); |
228 | 237 | |
229 | 238 | } elseif ( isset( $this->mParams['file'] ) ) { |