From: Aaron Schulz Date: Sat, 21 Apr 2012 18:47:14 +0000 (-0700) Subject: [FileRepo] Avoid performance degeration due to thumbnail requests with a read-only... X-Git-Tag: 1.31.0-rc.0~23830^2 X-Git-Url: https://git.cyclocoop.org/admin/?a=commitdiff_plain;h=3bc76e2526643e28923aba11c733990136f5ef97;p=lhc%2Fweb%2Fwiklou.git [FileRepo] Avoid performance degeration due to thumbnail requests with a read-only backend. Change-Id: I8663e64a0f16dac6d763a3f770b48c9be36680b8 --- 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 );