Merge "Call wfThumbIncrAttemptFailures() in thumb.php on fatals"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 21 Apr 2014 16:34:29 +0000 (16:34 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 21 Apr 2014 16:34:29 +0000 (16:34 +0000)
includes/filerepo/file/File.php
thumb.php

index fb20e96..84daa80 100644 (file)
@@ -1031,7 +1031,7 @@ abstract class File {
                        $tmpFile->bind( $thumb ); // keep alive with $thumb
 
                        if ( !$thumb ) { // bad params?
-                               $thumb = null;
+                               $thumb = false;
                        } elseif ( $thumb->isError() ) { // transform error
                                $this->lastError = $thumb->toText();
                                // Ignore errors if requested
index f2e3017..baa00e1 100644 (file)
--- a/thumb.php
+++ b/thumb.php
@@ -320,7 +320,14 @@ function wfStreamThumb( array $params ) {
        }
 
        // Thumbnail isn't already there, so create the new thumbnail...
+       $thumb = null;
        try {
+               // Record failures on PHP fatals too
+               register_shutdown_function( function() use ( &$thumb, $img, $thumbName ) {
+                       if ( $thumb === null ) { // transform() gave a fatal
+                               wfThumbIncrAttemptFailures( $img, $thumbName );
+                       }
+               } );
                $thumb = $img->transform( $params, File::RENDER_NOW );
        } catch ( Exception $ex ) {
                // Tried to select a page on a non-paged file?