Merge "Call $wgContLang->findVariantLink() in {{PAGESINCATEGORY: }}"
[lhc/web/wiklou.git] / includes / job / jobs / PublishStashedFileJob.php
index d3feda2..5a24f93 100644 (file)
@@ -42,13 +42,23 @@ class PublishStashedFileJob extends Job {
                                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(
                                $this->params['filekey'],
                                array( 'result' => 'Poll', 'stage' => 'publish', 'status' => Status::newGood() )
                        );
 
                        $upload = new UploadFromStash( $user );
-                       // @TODO: initialize() causes a GET, ideally we could frontload the antivirus
+                       // @todo initialize() causes a GET, ideally we could frontload the antivirus
                        // checks and anything else to the stash stage (which includes concatenation and
                        // the local file is thus already there). That way, instead of GET+PUT, there could
                        // just be a COPY operation from the stash to the public zone.
@@ -94,11 +104,11 @@ class PublishStashedFileJob extends Job {
                        UploadBase::setSessionStatus(
                                $this->params['filekey'],
                                array(
-                                       'result'    => 'Success',
-                                       'stage'     => 'publish',
-                                       'filename'  => $upload->getLocalFile()->getName(),
+                                       'result' => 'Success',
+                                       'stage' => 'publish',
+                                       'filename' => $upload->getLocalFile()->getName(),
                                        'imageinfo' => $imageInfo,
-                                       'status'    => Status::newGood()
+                                       'status' => Status::newGood()
                                )
                        );
                } catch ( MWException $e ) {
@@ -106,7 +116,7 @@ class PublishStashedFileJob extends Job {
                                $this->params['filekey'],
                                array(
                                        'result' => 'Failure',
-                                       'stage'  => 'publish',
+                                       'stage' => 'publish',
                                        'status' => Status::newFatal( 'api-error-publishfailed' )
                                )
                        );