X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiUpload.php;h=62d888289859ca7e92fe6bd64c52f26a53ad19bc;hb=e6696ed61129be255ba5e6032c2eadcab85ed3b8;hp=43e4c61e0cad026e7386fd19c95c8142afc36e49;hpb=8c3738e088f377642c540a0ccddb01b16ba7116b;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php index 43e4c61e0c..62d8882898 100644 --- a/includes/api/ApiUpload.php +++ b/includes/api/ApiUpload.php @@ -161,7 +161,7 @@ class ApiUpload extends ApiBase { } } catch ( UploadStashException $e ) { $this->handleStashException( $e ); - } catch ( MWException $e ) { + } catch ( Exception $e ) { $this->dieUsage( $e->getMessage(), 'stashfailed' ); } @@ -182,7 +182,7 @@ class ApiUpload extends ApiBase { try { $result['filekey'] = $this->performStash(); $result['sessionkey'] = $result['filekey']; // backwards compatibility - } catch ( MWException $e ) { + } catch ( Exception $e ) { $result['warnings']['stashfailed'] = $e->getMessage(); } @@ -209,7 +209,7 @@ class ApiUpload extends ApiBase { $filekey = $this->performStash(); } catch ( UploadStashException $e ) { $this->handleStashException( $e ); - } catch ( MWException $e ) { + } catch ( Exception $e ) { // FIXME: Error handling here is wrong/different from rest of this $this->dieUsage( $e->getMessage(), 'stashfailed' ); } @@ -277,13 +277,13 @@ class ApiUpload extends ApiBase { */ private function performStash() { try { - $stashFile = $this->mUpload->stashFile(); + $stashFile = $this->mUpload->stashFile( $this->getUser() ); if ( !$stashFile ) { throw new MWException( 'Invalid stashed file' ); } $fileKey = $stashFile->getFileKey(); - } catch ( MWException $e ) { + } catch ( Exception $e ) { $message = 'Stashing temporary file failed: ' . get_class( $e ) . ' ' . $e->getMessage(); wfDebug( __METHOD__ . ' ' . $message . "\n" ); $className = get_class( $e ); @@ -306,7 +306,7 @@ class ApiUpload extends ApiBase { try { $data['filekey'] = $this->performStash(); $data['sessionkey'] = $data['filekey']; - } catch ( MWException $e ) { + } catch ( Exception $e ) { $data['stashfailed'] = $e->getMessage(); } $data['invalidparameter'] = $parameter;