Made upload jobs avoid using the user session
[lhc/web/wiklou.git] / includes / jobqueue / jobs / AssembleUploadChunksJob.php
index 9e9bda6..cc28a01 100644 (file)
@@ -35,26 +35,16 @@ class AssembleUploadChunksJob extends Job {
        public function run() {
                $scope = RequestContext::importScopedSession( $this->params['session'] );
                $context = RequestContext::getMain();
+               $user = $context->getUser();
                try {
-                       $user = $context->getUser();
                        if ( !$user->isLoggedIn() ) {
                                $this->setLastError( "Could not load the author user from session." );
 
                                return false;
                        }
 
-                       if ( count( $_SESSION ) === 0 ) {
-                               // Empty session probably indicates that we didn't associate
-                               // with the session correctly. Note that being able to load
-                               // the user does not necessarily mean the session was loaded.
-                               // Most likely cause by suhosin.session.encrypt = On.
-                               $this->setLastError( "Error associating with user session. " .
-                                       "Try setting suhosin.session.encrypt = Off" );
-
-                               return false;
-                       }
-
                        UploadBase::setSessionStatus(
+                               $user,
                                $this->params['filekey'],
                                array( 'result' => 'Poll', 'stage' => 'assembling', 'status' => Status::newGood() )
                        );
@@ -70,6 +60,7 @@ class AssembleUploadChunksJob extends Job {
                        $status = $upload->concatenateChunks();
                        if ( !$status->isGood() ) {
                                UploadBase::setSessionStatus(
+                                       $user,
                                        $this->params['filekey'],
                                        array( 'result' => 'Failure', 'stage' => 'assembling', 'status' => $status )
                                );
@@ -93,6 +84,7 @@ class AssembleUploadChunksJob extends Job {
 
                        // Cache the info so the user doesn't have to wait forever to get the final info
                        UploadBase::setSessionStatus(
+                               $user,
                                $this->params['filekey'],
                                array(
                                        'result' => 'Success',
@@ -104,6 +96,7 @@ class AssembleUploadChunksJob extends Job {
                        );
                } catch ( MWException $e ) {
                        UploadBase::setSessionStatus(
+                               $user,
                                $this->params['filekey'],
                                array(
                                        'result' => 'Failure',