X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/recherche.php?a=blobdiff_plain;f=includes%2Fupload%2FUploadFromChunks.php;h=54a68af3810681b46d2d0030983ff014e27f26d1;hb=29719f846b8887e1190ddf85125387c079f9539b;hp=e50c6da0b7d9db33aad96f9421d651689d4856e5;hpb=176119237607de5ed6659296b08209270b26b84a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/upload/UploadFromChunks.php b/includes/upload/UploadFromChunks.php index e50c6da0b7..54a68af381 100644 --- a/includes/upload/UploadFromChunks.php +++ b/includes/upload/UploadFromChunks.php @@ -29,10 +29,10 @@ */ class UploadFromChunks extends UploadFromFile { protected $mOffset, $mChunkIndex, $mFileKey, $mVirtualTempPath; - + /** * Setup local pointers to stash, repo and user ( similar to UploadFromStash ) - * + * * @param $user User * @param $stash UploadStash * @param $repo FileRepo @@ -77,12 +77,12 @@ class UploadFromChunks extends UploadFromFile { // Output a copy of this first to chunk 0 location: $status = $this->outputChunk( $this->mLocalFile->getPath() ); - + // Update db table to reflect initial "chunk" state $this->updateChunkStatus(); return $this->mLocalFile; } - + /** * Continue chunk uploading */ @@ -91,7 +91,7 @@ class UploadFromChunks extends UploadFromFile { $this->mUpload = $webRequestUpload; // Get the chunk status form the db: $this->getChunkStatus(); - + $metadata = $this->stash->getMetadata( $key ); $this->initializePathInfo( $name, $this->getRealPath( $metadata['us_path'] ), @@ -99,7 +99,7 @@ class UploadFromChunks extends UploadFromFile { false ); } - + /** * Append the final chunk and ready file for parent::performUpload() * @return FileRepoStatus @@ -194,14 +194,14 @@ class UploadFromChunks extends UploadFromFile { } return $status; } - + /** * Update the chunk db table with the current status: */ private function updateChunkStatus(){ wfDebug( __METHOD__ . " update chunk status for {$this->mFileKey} offset:" . $this->getOffset() . ' inx:' . $this->getChunkIndex() . "\n" ); - + $dbw = $this->repo->getMasterDb(); $dbw->update( 'uploadstash', @@ -214,6 +214,7 @@ class UploadFromChunks extends UploadFromFile { __METHOD__ ); } + /** * Get the chunk db state and populate update relevant local values */ @@ -238,6 +239,7 @@ class UploadFromChunks extends UploadFromFile { $this->mVirtualTempPath = $row->us_path; } } + /** * Get the current Chunk index * @return Integer index of the current chunk @@ -248,7 +250,7 @@ class UploadFromChunks extends UploadFromFile { } return 0; } - + /** * Gets the current offset in fromt the stashedupload table * @return Integer current byte offset of the chunk file set @@ -259,11 +261,12 @@ class UploadFromChunks extends UploadFromFile { } return 0; } - + /** * Output the chunk to disk - * + * * @param $chunkPath string + * @throws UploadChunkFileException * @return FileRepoStatus */ private function outputChunk( $chunkPath ){ @@ -289,6 +292,7 @@ class UploadFromChunks extends UploadFromFile { } return $storeStatus; } + private function getChunkFileKey( $index = null ){ if( $index === null ){ $index = $this->getChunkIndex();