Do thumb attempt-failures limitting via sha1 instead of name.
authorBrian Wolff <bawolff+wn@gmail.com>
Mon, 30 Jun 2014 00:24:18 +0000 (21:24 -0300)
committerBrian Wolff <bawolff+wn@gmail.com>
Mon, 30 Jun 2014 00:24:18 +0000 (21:24 -0300)
Otherwise if there is a broken file, and somebody fixes the file,
it could take an hour before thumbs are generated again. This
might confuse the user, and they may revert back to the broken
version thinking their fix didn't work.

Originally reported by Fae on wiki.

Change-Id: I024702391e5f7ccf10a406a29485601f64069405

thumb.php

index c611dc3..c0042c2 100644 (file)
--- a/thumb.php
+++ b/thumb.php
@@ -367,7 +367,7 @@ function wfGenerateThumbnail( File $file, array $params, $thumbName, $thumbPath
        global $wgMemc, $wgAttemptFailureEpoch;
 
        $key = wfMemcKey( 'attempt-failures', $wgAttemptFailureEpoch,
-               $file->getRepo()->getName(), md5( $file->getName() ), md5( $thumbName ) );
+               $file->getRepo()->getName(), $file->getSha1(), md5( $thumbName ) );
 
        // Check if this file keeps failing to render
        if ( $wgMemc->get( $key ) >= 4 ) {