From: Brian Wolff Date: Thu, 5 Nov 2015 06:59:58 +0000 (-0700) Subject: Fix name of PoolCounter callback in thumb.php X-Git-Tag: 1.31.0-rc.0~9089^2 X-Git-Url: http://git.cyclocoop.org/%22.%28%24lien.?a=commitdiff_plain;h=b47a86316dad7737d76a94c3de9895858e280750;p=lhc%2Fweb%2Fwiklou.git Fix name of PoolCounter callback in thumb.php The callback is named doCachedWork, not getCachedWork. The typo made it so that if multiple people try to render a file at once, MediaWiki would not check if the last person to go already did the needed work. This might not make as much difference as it would sound, as the pool counter lock is for the entire file, not a specific size, and I'm unsure if swift has an equivalent of "slave lag", where the check to see if a cached version is available might happen before the write is totally visible. Also merge the fallback handler into the error handler, so we get actually error messages reported. Change-Id: I12d228961de39cffc3d492554d93e30bd741adc9 --- diff --git a/thumb.php b/thumb.php index c699bb19ab..34f641d1ea 100644 --- a/thumb.php +++ b/thumb.php @@ -420,18 +420,15 @@ function wfGenerateThumbnail( File $file, array $params, $thumbName, $thumbPath 'doWork' => function () use ( $file, $params ) { return $file->transform( $params, File::RENDER_NOW ); }, - 'getCachedWork' => function () use ( $file, $params, $thumbPath ) { + 'doCachedWork' => function () use ( $file, $params, $thumbPath ) { // If the worker that finished made this thumbnail then use it. // Otherwise, it probably made a different thumbnail for this file. return $file->getRepo()->fileExists( $thumbPath ) ? $file->transform( $params, File::RENDER_NOW ) : false; // retry once more in exclusive mode }, - 'fallback' => function () { - return wfMessage( 'generic-pool-error' )->parse(); - }, 'error' => function ( Status $status ) { - return $status->getHTML(); + return wfMessage( 'generic-pool-error' )->parse() . '
' . $status->getHTML(); } ) );