Merge "ApiSandbox: Visual separation of fields"
[lhc/web/wiklou.git] / includes / upload / UploadFromChunks.php
index 3c249ce..d82a9e6 100644 (file)
@@ -122,7 +122,7 @@ class UploadFromChunks extends UploadFromFile {
                        $this->getOffset() . ' inx:' . $chunkIndex . "\n" );
 
                // Concatenate all the chunks to mVirtualTempPath
-               $fileList = array();
+               $fileList = [];
                // The first chunk is stored at the mVirtualTempPath path so we start on "chunk 1"
                for ( $i = 0; $i <= $chunkIndex; $i++ ) {
                        $fileList[] = $this->getVirtualChunkLocation( $i );
@@ -170,20 +170,6 @@ class UploadFromChunks extends UploadFromFile {
                return $status;
        }
 
-       /**
-        * Perform the upload, then remove the temp copy afterward
-        * @param string $comment
-        * @param string $pageText
-        * @param bool $watch
-        * @param User $user
-        * @return Status
-        */
-       public function performUpload( $comment, $pageText, $watch, $user ) {
-               $rv = parent::performUpload( $comment, $pageText, $watch, $user );
-
-               return $rv;
-       }
-
        /**
         * Returns the virtual chunk location:
         * @param int $index
@@ -251,18 +237,17 @@ class UploadFromChunks extends UploadFromFile {
                $dbw = $this->repo->getMasterDb();
                // Use a quick transaction since we will upload the full temp file into shared
                // storage, which takes time for large files. We don't want to hold locks then.
-               $dbw->begin( __METHOD__ );
                $dbw->update(
                        'uploadstash',
-                       array(
+                       [
                                'us_status' => 'chunks',
                                'us_chunk_inx' => $this->getChunkIndex(),
                                'us_size' => $this->getOffset()
-                       ),
-                       array( 'us_key' => $this->mFileKey ),
+                       ],
+                       [ 'us_key' => $this->mFileKey ],
                        __METHOD__
                );
-               $dbw->commit( __METHOD__ );
+               $dbw->commit( __METHOD__, 'flush' );
        }
 
        /**
@@ -274,12 +259,12 @@ class UploadFromChunks extends UploadFromFile {
                $dbw = $this->repo->getMasterDb();
                $row = $dbw->selectRow(
                        'uploadstash',
-                       array(
+                       [
                                'us_chunk_inx',
                                'us_size',
                                'us_path',
-                       ),
-                       array( 'us_key' => $this->mFileKey ),
+                       ],
+                       [ 'us_key' => $this->mFileKey ],
                        __METHOD__
                );
                // Handle result:
@@ -338,7 +323,7 @@ class UploadFromChunks extends UploadFromFile {
                                $error = $storeStatus->getWarningsArray();
                                $error = reset( $error );
                                if ( !count( $error ) ) {
-                                       $error = array( 'unknown', 'no error recorded' );
+                                       $error = [ 'unknown', 'no error recorded' ];
                                }
                        }
                        throw new UploadChunkFileException( "Error storing file in '$chunkPath': " .