Merge "Check for warnings for assembled file after a chunked upload"

This commit is contained in:
jenkins-bot 2016-08-19 02:01:26 +00:00 committed by Gerrit Code Review
commit 439e9bacd4
2 changed files with 17 additions and 1 deletions

View file

@ -274,6 +274,12 @@ class ApiUpload extends ApiBase {
$this->dieStatusWithCode( $status, 'stashfailed' );
}
// We can only get warnings like 'duplicate' after concatenating the chunks
$warnings = $this->getApiWarnings();
if ( $warnings ) {
$result['warnings'] = $warnings;
}
// The fully concatenated file has a new filekey. So remove
// the old filekey and fetch the new one.
UploadBase::setSessionStatus( $this->getUser(), $filekey, false );
@ -431,6 +437,12 @@ class ApiUpload extends ApiBase {
if ( isset( $progress['status']->value['verification'] ) ) {
$this->checkVerification( $progress['status']->value['verification'] );
}
if ( isset( $progress['status']->value['warnings'] ) ) {
$warnings = $this->transformWarnings( $progress['status']->value['warnings'] );
if ( $warnings ) {
$progress['warnings'] = $warnings;
}
}
unset( $progress['status'] ); // remove Status object
$this->getResult()->addValue( null, $this->getModuleName(), $progress );

View file

@ -73,6 +73,10 @@ class AssembleUploadChunksJob extends Job {
return false;
}
// We can only get warnings like 'duplicate' after concatenating the chunks
$status = Status::newGood();
$status->value = [ 'warnings' => $upload->checkWarnings() ];
// We have a new filekey for the fully concatenated file
$newFileKey = $upload->getStashFile()->getFileKey();
@ -95,7 +99,7 @@ class AssembleUploadChunksJob extends Job {
'stage' => 'assembling',
'filekey' => $newFileKey,
'imageinfo' => $imageInfo,
'status' => Status::newGood()
'status' => $status
]
);
} catch ( Exception $e ) {