From 3bc76e2526643e28923aba11c733990136f5ef97 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Sat, 21 Apr 2012 11:47:14 -0700 Subject: [PATCH] [FileRepo] Avoid performance degeration due to thumbnail requests with a read-only backend. Change-Id: I8663e64a0f16dac6d763a3f770b48c9be36680b8 --- includes/filerepo/file/File.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php index ae11e673d9..461c255382 100644 --- a/includes/filerepo/file/File.php +++ b/includes/filerepo/file/File.php @@ -842,6 +842,13 @@ abstract class File { } } + // If the backend is ready-only, don't keep generating thumbnails + // only to return transformation errors, just return the error now. + if ( $this->repo->getReadOnlyReason() !== false ) { + $thumb = $this->transformErrorOutput( $thumbPath, $thumbUrl, $params, $flags ); + break; + } + // Create a temp FS file with the same extension and the thumbnail $thumbExt = FileBackend::extensionFromPath( $thumbPath ); $tmpFile = TempFSFile::factory( 'transform_', $thumbExt ); -- 2.20.1