Merge "Avoid "Unable to set value to APCBagOStuff" exceptions"
[lhc/web/wiklou.git] / includes / jobqueue / jobs / ThumbnailRenderJob.php
index a58fa8b..0abc0e3 100644 (file)
@@ -50,23 +50,25 @@ class ThumbnailRenderJob extends Job {
                                        return false;
                                }
                        } elseif ( $wgUploadThumbnailRenderMethod === 'http' ) {
-                               $status = $this->hitThumbUrl( $file, $transformParams );
+                               $thumbUrl = '';
+                               $status = $this->hitThumbUrl( $file, $transformParams, $thumbUrl );
 
                                wfDebug( __METHOD__ . ": received status {$status}\n" );
 
-                               if ( $status === 200 || $status === 301 || $status === 302 ) {
+                               // 400 happens when requesting a size greater or equal than the original
+                               if ( $status === 200 || $status === 301 || $status === 302 || $status === 400 ) {
                                        return true;
                                } elseif ( $status ) {
-                                       // Note that this currently happens (500) when requesting sizes larger then or
-                                       // equal to the original, which is harmless.
-                                       $this->setLastError( __METHOD__ . ': incorrect HTTP status ' . $status );
+                                       $this->setLastError( __METHOD__ . ': incorrect HTTP status ' .
+                                               $status . ' when hitting ' . $thumbUrl );
                                        return false;
                                } else {
                                        $this->setLastError( __METHOD__ . ': HTTP request failure' );
                                        return false;
                                }
                        } else {
-                               $this->setLastError( __METHOD__ . ': unknown thumbnail render method ' . $wgUploadThumbnailRenderMethod );
+                               $this->setLastError( __METHOD__ . ': unknown thumbnail render method ' .
+                                       $wgUploadThumbnailRenderMethod );
                                return false;
                        }
                } else {
@@ -75,7 +77,7 @@ class ThumbnailRenderJob extends Job {
                }
        }
 
-       protected function hitThumbUrl( $file, $transformParams ) {
+       protected function hitThumbUrl( $file, $transformParams, &$thumbUrl ) {
                global $wgUploadThumbnailRenderHttpCustomHost, $wgUploadThumbnailRenderHttpCustomDomain;
 
                $thumbName = $file->thumbName( $transformParams );