Support redirects in JavaScriptContent
[lhc/web/wiklou.git] / thumb.php
index b530bb5..5c4eea7 100644 (file)
--- a/thumb.php
+++ b/thumb.php
@@ -301,9 +301,14 @@ function wfStreamThumb( array $params ) {
        // Stream the file if it exists already...
        $thumbPath = $img->getThumbPath( $thumbName );
        if ( $img->getRepo()->fileExists( $thumbPath ) ) {
+               $starttime = microtime( true );
                $success = $img->getRepo()->streamFile( $thumbPath, $headers );
+               $streamtime = microtime( true ) - $starttime;
+
                if ( !$success ) {
                        wfThumbError( 500, 'Could not stream the file' );
+               } else {
+                       RequestContext::getMain()->getStats()->timing( 'media.thumbnail.stream', $streamtime );
                }
                return;
        }
@@ -317,8 +322,8 @@ function wfStreamThumb( array $params ) {
                return;
        }
 
-       // Actually generate a new thumbnail
        list( $thumb, $errorMsg ) = wfGenerateThumbnail( $img, $params, $thumbName, $thumbPath );
+
        /** @var MediaTransformOutput|bool $thumb */
 
        // Check for thumbnail generation errors...