dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Reset scoped session for upload jobs after deferred updates"
[lhc/web/wiklou.git]
/
includes
/
jobqueue
/
jobs
/
AssembleUploadChunksJob.php
diff --git
a/includes/jobqueue/jobs/AssembleUploadChunksJob.php
b/includes/jobqueue/jobs/AssembleUploadChunksJob.php
index
b7f09e7
..
bc2f7c4
100644
(file)
--- a/
includes/jobqueue/jobs/AssembleUploadChunksJob.php
+++ b/
includes/jobqueue/jobs/AssembleUploadChunksJob.php
@@
-27,13
+27,18
@@
* @ingroup Upload
*/
class AssembleUploadChunksJob extends Job {
* @ingroup Upload
*/
class AssembleUploadChunksJob extends Job {
- public function __construct(
$title,
$params ) {
+ public function __construct(
Title $title, array
$params ) {
parent::__construct( 'AssembleUploadChunks', $title, $params );
$this->removeDuplicates = true;
}
public function run() {
parent::__construct( 'AssembleUploadChunks', $title, $params );
$this->removeDuplicates = true;
}
public function run() {
+ /** @noinspection PhpUnusedLocalVariableInspection */
$scope = RequestContext::importScopedSession( $this->params['session'] );
$scope = RequestContext::importScopedSession( $this->params['session'] );
+ $this->addTeardownCallback( function () use ( &$scope ) {
+ ScopedCallback::consume( $scope ); // T126450
+ } );
+
$context = RequestContext::getMain();
$user = $context->getUser();
try {
$context = RequestContext::getMain();
$user = $context->getUser();
try {
@@
-46,14
+51,14
@@
class AssembleUploadChunksJob extends Job {
UploadBase::setSessionStatus(
$user,
$this->params['filekey'],
UploadBase::setSessionStatus(
$user,
$this->params['filekey'],
- array( 'result' => 'Poll', 'stage' => 'assembling', 'status' => Status::newGood() )
+ [ 'result' => 'Poll', 'stage' => 'assembling', 'status' => Status::newGood() ]
);
$upload = new UploadFromChunks( $user );
$upload->continueChunks(
$this->params['filename'],
$this->params['filekey'],
);
$upload = new UploadFromChunks( $user );
$upload->continueChunks(
$this->params['filename'],
$this->params['filekey'],
-
$context->getRequest(
)
+
new WebRequestUpload( $context->getRequest(), 'null'
)
);
// Combine all of the chunks into a local file and upload that to a new stash file
);
// Combine all of the chunks into a local file and upload that to a new stash file
@@
-62,7
+67,7
@@
class AssembleUploadChunksJob extends Job {
UploadBase::setSessionStatus(
$user,
$this->params['filekey'],
UploadBase::setSessionStatus(
$user,
$this->params['filekey'],
- array( 'result' => 'Failure', 'stage' => 'assembling', 'status' => $status )
+ [ 'result' => 'Failure', 'stage' => 'assembling', 'status' => $status ]
);
$this->setLastError( $status->getWikiText() );
);
$this->setLastError( $status->getWikiText() );
@@
-86,25
+91,25
@@
class AssembleUploadChunksJob extends Job {
UploadBase::setSessionStatus(
$user,
$this->params['filekey'],
UploadBase::setSessionStatus(
$user,
$this->params['filekey'],
- array(
+ [
'result' => 'Success',
'stage' => 'assembling',
'filekey' => $newFileKey,
'imageinfo' => $imageInfo,
'status' => Status::newGood()
'result' => 'Success',
'stage' => 'assembling',
'filekey' => $newFileKey,
'imageinfo' => $imageInfo,
'status' => Status::newGood()
- )
+ ]
);
} catch ( Exception $e ) {
UploadBase::setSessionStatus(
$user,
$this->params['filekey'],
);
} catch ( Exception $e ) {
UploadBase::setSessionStatus(
$user,
$this->params['filekey'],
- array(
+ [
'result' => 'Failure',
'stage' => 'assembling',
'status' => Status::newFatal( 'api-error-stashfailed' )
'result' => 'Failure',
'stage' => 'assembling',
'status' => Status::newFatal( 'api-error-stashfailed' )
- )
+ ]
);
);
- $this->setLastError( get_class( $e ) . ": " . $e->get
Text
() );
+ $this->setLastError( get_class( $e ) . ": " . $e->get
Message
() );
// To be extra robust.
MWExceptionHandler::rollbackMasterChangesAndLog( $e );
// To be extra robust.
MWExceptionHandler::rollbackMasterChangesAndLog( $e );
@@
-117,7
+122,7
@@
class AssembleUploadChunksJob extends Job {
public function getDeduplicationInfo() {
$info = parent::getDeduplicationInfo();
if ( is_array( $info['params'] ) ) {
public function getDeduplicationInfo() {
$info = parent::getDeduplicationInfo();
if ( is_array( $info['params'] ) ) {
- $info['params'] =
array( 'filekey' => $info['params']['filekey'] )
;
+ $info['params'] =
[ 'filekey' => $info['params']['filekey'] ]
;
}
return $info;
}
return $info;