Merge "jquery.makeCollapsible: minor fixes to togglingHandler()"
[lhc/web/wiklou.git] / includes / job / jobs / PublishStashedFileJob.php
index 594d304..625e8aa 100644 (file)
@@ -37,9 +37,9 @@ class PublishStashedFileJob extends Job {
                $context = RequestContext::getMain();
                try {
                        $user = $context->getUser();
-                       if ( !$user->isLoggedIn() || $user->getId() != $this->params['userid'] ) {
+                       if ( !$user->isLoggedIn() ) {
                                $this->setLastError( "Could not load the author user from session." );
-                               return true; // no retries
+                               return false;
                        }
 
                        UploadBase::setSessionStatus(
@@ -64,7 +64,7 @@ class PublishStashedFileJob extends Job {
                                        array( 'result' => 'Failure', 'stage' => 'publish', 'status' => $status )
                                );
                                $this->setLastError( "Could not verify upload." );
-                               return true; // no retries
+                               return false;
                        }
 
                        // Upload the stashed file to a permanent location
@@ -80,7 +80,7 @@ class PublishStashedFileJob extends Job {
                                        array( 'result' => 'Failure', 'stage' => 'publish', 'status' => $status )
                                );
                                $this->setLastError( $status->getWikiText() );
-                               return true; // no retries
+                               return false;
                        }
 
                        // Build the image info array while we have the local reference handy
@@ -94,11 +94,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,18 +106,16 @@ class PublishStashedFileJob extends Job {
                                $this->params['filekey'],
                                array(
                                        'result' => 'Failure',
-                                       'stage'  => 'publish',
+                                       'stage' => 'publish',
                                        'status' => Status::newFatal( 'api-error-publishfailed' )
                                )
                        );
                        $this->setLastError( get_class( $e ) . ": " . $e->getText() );
+                       return false;
                }
-               return true; // returns true on success and erro (no retries)
+               return true;
        }
 
-       /**
-        * @return Array
-        */
        public function getDeduplicationInfo() {
                $info = parent::getDeduplicationInfo();
                if ( is_array( $info['params'] ) ) {
@@ -125,4 +123,8 @@ class PublishStashedFileJob extends Job {
                }
                return $info;
        }
+
+       public function allowRetries() {
+               return false;
+       }
 }