}
public function run() {
- /** @noinspection PhpUnusedLocalVariableInspection */
$scope = RequestContext::importScopedSession( $this->params['session'] );
+ $this->addTeardownCallback( function () use ( &$scope ) {
+ ScopedCallback::consume( $scope ); // T126450
+ } );
+
$context = RequestContext::getMain();
$user = $context->getUser();
try {
UploadBase::setSessionStatus(
$user,
$this->params['filekey'],
- array( 'result' => 'Poll', 'stage' => 'publish', 'status' => Status::newGood() )
+ [ 'result' => 'Poll', 'stage' => 'publish', 'status' => Status::newGood() ]
);
$upload = new UploadFromStash( $user );
$verification = $upload->verifyUpload();
if ( $verification['status'] !== UploadBase::OK ) {
$status = Status::newFatal( 'verification-error' );
- $status->value = array( 'verification' => $verification );
+ $status->value = [ 'verification' => $verification ];
UploadBase::setSessionStatus(
$user,
$this->params['filekey'],
- array( 'result' => 'Failure', 'stage' => 'publish', 'status' => $status )
+ [ 'result' => 'Failure', 'stage' => 'publish', 'status' => $status ]
);
$this->setLastError( "Could not verify upload." );
$this->params['text'],
$this->params['watch'],
$user,
- isset( $this->params['tags'] ) ? $this->params['tags'] : array()
+ isset( $this->params['tags'] ) ? $this->params['tags'] : []
);
if ( !$status->isGood() ) {
UploadBase::setSessionStatus(
$user,
$this->params['filekey'],
- array( 'result' => 'Failure', 'stage' => 'publish', 'status' => $status )
+ [ 'result' => 'Failure', 'stage' => 'publish', 'status' => $status ]
);
- $this->setLastError( $status->getWikiText() );
+ $this->setLastError( $status->getWikiText( false, false, 'en' ) );
return false;
}
UploadBase::setSessionStatus(
$user,
$this->params['filekey'],
- array(
+ [
'result' => 'Success',
'stage' => 'publish',
'filename' => $upload->getLocalFile()->getName(),
'imageinfo' => $imageInfo,
'status' => Status::newGood()
- )
+ ]
);
} catch ( Exception $e ) {
UploadBase::setSessionStatus(
$user,
$this->params['filekey'],
- array(
+ [
'result' => 'Failure',
'stage' => 'publish',
'status' => Status::newFatal( 'api-error-publishfailed' )
- )
+ ]
);
$this->setLastError( get_class( $e ) . ": " . $e->getMessage() );
// To prevent potential database referential integrity issues.
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;