}
/**
- * Calls the parent stashFile and updates the uploadsession table to handle "chunks"
+ * Calls the parent doStashFile and updates the uploadsession table to handle "chunks"
*
* @param User|null $user
* @return UploadStashFile Stashed file
*/
- public function stashFile( User $user = null ) {
+ protected function doStashFile( User $user = null ) {
// Stash file is the called on creating a new chunk session:
$this->mChunkIndex = 0;
$this->mOffset = 0;
$this->verifyChunk();
// Create a local stash target
- $this->mLocalFile = parent::stashFile( $user );
+ $this->mLocalFile = parent::doStashFile( $user );
// Update the initial file offset (based on file size)
$this->mOffset = $this->mLocalFile->getSize();
$this->mFileKey = $this->mLocalFile->getFileKey();
$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." );
- // File system path
- $this->mTempPath = $tmpPath;
- // Since this was set for the last chunk previously
- $this->mFileSize = filesize( $this->mTempPath );
+ // File system path of the actual full temp file
+ $this->setTempFile( $tmpPath );
+
$ret = $this->verifyUpload();
if ( $ret['status'] !== UploadBase::OK ) {
wfDebugLog( 'fileconcatenate', "Verification failed for chunked upload" );
// Update the mTempPath and mLocalFile
// (for FileUpload or normal Stash to take over)
$tStart = microtime( true );
- $this->mLocalFile = parent::stashFile( $this->user );
+ $this->mLocalFile = parent::doStashFile( $this->user );
$tAmount = microtime( true ) - $tStart;
$this->mLocalFile->setLocalReference( $tmpFile ); // reuse (e.g. for getImageInfo())
wfDebugLog( 'fileconcatenate', "Stashed combined file ($i chunks) in $tAmount seconds." );
wfDebug( __METHOD__ . " update chunk status for {$this->mFileKey} offset:" .
$this->getOffset() . ' inx:' . $this->getChunkIndex() . "\n" );
- $dbw = $this->repo->getMasterDb();
+ $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->update(
private function getChunkStatus() {
// get Master db to avoid race conditions.
// Otherwise, if chunk upload time < replag there will be spurious errors
- $dbw = $this->repo->getMasterDb();
+ $dbw = $this->repo->getMasterDB();
$row = $dbw->selectRow(
'uploadstash',
[