diff options
Diffstat (limited to 'includes/upload/UploadFromChunks.php')
-rw-r--r-- | includes/upload/UploadFromChunks.php | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/includes/upload/UploadFromChunks.php b/includes/upload/UploadFromChunks.php index 4b331e98..2e0b9444 100644 --- a/includes/upload/UploadFromChunks.php +++ b/includes/upload/UploadFromChunks.php @@ -31,7 +31,7 @@ class UploadFromChunks extends UploadFromFile { protected $mOffset, $mChunkIndex, $mFileKey, $mVirtualTempPath; /** - * Setup local pointers to stash, repo and user ( similar to UploadFromStash ) + * Setup local pointers to stash, repo and user (similar to UploadFromStash) * * @param $user User * @param $stash UploadStash @@ -41,16 +41,16 @@ class UploadFromChunks extends UploadFromFile { // user object. sometimes this won't exist, as when running from cron. $this->user = $user; - if( $repo ) { + if ( $repo ) { $this->repo = $repo; } else { $this->repo = RepoGroup::singleton()->getLocalRepo(); } - if( $stash ) { + if ( $stash ) { $this->stash = $stash; } else { - if( $user ) { + if ( $user ) { wfDebug( __METHOD__ . " creating new UploadFromChunks instance for " . $user->getId() . "\n" ); } else { wfDebug( __METHOD__ . " creating new UploadFromChunks instance with no user\n" ); @@ -74,7 +74,7 @@ class UploadFromChunks extends UploadFromFile { $this->verifyChunk(); // Create a local stash target $this->mLocalFile = parent::stashFile(); - // Update the initial file offset ( based on file size ) + // Update the initial file offset (based on file size) $this->mOffset = $this->mLocalFile->getSize(); $this->mFileKey = $this->mLocalFile->getFileKey(); @@ -114,7 +114,7 @@ class UploadFromChunks extends UploadFromFile { // Concatenate all the chunks to mVirtualTempPath $fileList = Array(); // The first chunk is stored at the mVirtualTempPath path so we start on "chunk 1" - for( $i = 0; $i <= $this->getChunkIndex(); $i++ ) { + for ( $i = 0; $i <= $this->getChunkIndex(); $i++ ) { $fileList[] = $this->getVirtualChunkLocation( $i ); } @@ -129,7 +129,7 @@ class UploadFromChunks extends UploadFromFile { $tStart = microtime( true ); $status = $this->repo->concatenate( $fileList, $tmpPath, FileRepo::DELETE_SOURCE ); $tAmount = microtime( true ) - $tStart; - if( !$status->isOk() ) { + if ( !$status->isOk() ) { return $status; } wfDebugLog( 'fileconcatenate', "Combined $i chunks in $tAmount seconds.\n" ); @@ -144,7 +144,7 @@ class UploadFromChunks extends UploadFromFile { } // Update the mTempPath and mLocalFile - // ( for FileUpload or normal Stash to take over ) + // (for FileUpload or normal Stash to take over) $tStart = microtime( true ); $this->mLocalFile = parent::stashFile( $this->user ); $tAmount = microtime( true ) - $tStart; @@ -193,7 +193,7 @@ class UploadFromChunks extends UploadFromFile { // Get the offset before we add the chunk to the file system $preAppendOffset = $this->getOffset(); - if ( $preAppendOffset + $chunkSize > $this->getMaxUploadSize()) { + if ( $preAppendOffset + $chunkSize > $this->getMaxUploadSize() ) { $status = Status::newFatal( 'file-too-large' ); } else { // Make sure the client is uploading the correct chunk with a matching offset. @@ -210,7 +210,7 @@ class UploadFromChunks extends UploadFromFile { return Status::newFatal( $e->getMessage() ); } $status = $this->outputChunk( $chunkPath ); - if( $status->isGood() ) { + if ( $status->isGood() ) { // Update local offset: $this->mOffset = $preAppendOffset + $chunkSize; // Update chunk table status db @@ -277,7 +277,7 @@ class UploadFromChunks extends UploadFromFile { * @return Integer index of the current chunk */ private function getChunkIndex() { - if( $this->mChunkIndex !== null ) { + if ( $this->mChunkIndex !== null ) { return $this->mChunkIndex; } return 0; @@ -327,7 +327,7 @@ class UploadFromChunks extends UploadFromFile { } private function getChunkFileKey( $index = null ) { - if( $index === null ) { + if ( $index === null ) { $index = $this->getChunkIndex(); } return $this->mFileKey . '.' . $index; @@ -346,7 +346,7 @@ class UploadFromChunks extends UploadFromFile { $res = $this->verifyPartialFile(); $this->mDesiredDestName = $oldDesiredDestName; $this->mTitle = false; - if( is_array( $res ) ) { + if ( is_array( $res ) ) { throw new UploadChunkVerificationException( $res[0] ); } } |