jenkins-bot has submitted this change and it was merged.

Change subject: Check for warnings for assembled file after a chunked upload
......................................................................


Check for warnings for assembled file after a chunked upload

Bug: T130564
Change-Id: Iebc84f030c45c634dc29b02cbd720f33abf50f2b
---
M includes/api/ApiUpload.php
M includes/jobqueue/jobs/AssembleUploadChunksJob.php
2 files changed, 17 insertions(+), 1 deletion(-)

Approvals:
  Aaron Schulz: Looks good to me, approved
  Jforrester: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php
index 227278c..ac817ba 100644
--- a/includes/api/ApiUpload.php
+++ b/includes/api/ApiUpload.php
@@ -274,6 +274,12 @@
                                        $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 @@
                        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 );
 
diff --git a/includes/jobqueue/jobs/AssembleUploadChunksJob.php 
b/includes/jobqueue/jobs/AssembleUploadChunksJob.php
index f3fcadf..060cabb 100644
--- a/includes/jobqueue/jobs/AssembleUploadChunksJob.php
+++ b/includes/jobqueue/jobs/AssembleUploadChunksJob.php
@@ -73,6 +73,10 @@
                                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 @@
                                        'stage' => 'assembling',
                                        'filekey' => $newFileKey,
                                        'imageinfo' => $imageInfo,
-                                       'status' => Status::newGood()
+                                       'status' => $status
                                ]
                        );
                } catch ( Exception $e ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/305284
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iebc84f030c45c634dc29b02cbd720f33abf50f2b
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <matma....@gmail.com>
Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: Anomie <bjor...@wikimedia.org>
Gerrit-Reviewer: Bartosz Dziewoński <matma....@gmail.com>
Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org>
Gerrit-Reviewer: MarkTraceur <mholmqu...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to