Remove getSecondaryDataUpdates and friends from ParserOutput.
[lhc/web/wiklou.git] / includes / api / ApiUpload.php
index 43e4c61..78a4971 100644 (file)
@@ -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' );
                        }
@@ -218,7 +218,11 @@ class ApiUpload extends ApiBase {
                        $status = $this->mUpload->addChunk(
                                $chunkPath, $chunkSize, $this->mParams['offset'] );
                        if ( !$status->isGood() ) {
-                               $this->dieUsage( $status->getWikiText(), 'stashfailed' );
+                               $extradata = array(
+                                       'offset' => $this->mUpload->getOffset(),
+                               );
+
+                               $this->dieUsage( $status->getWikiText(), 'stashfailed', 0, $extradata );
 
                                return array();
                        }
@@ -277,13 +281,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 +310,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;