From fe2ca6c15eb04345448dd0674af4c5c8eb8ea8a8 Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Fri, 18 Sep 2020 00:11:11 -0600 Subject: [PATCH] Fix issue where resized images were not correctly identified as already having been resized when atomic (blue/green) deployment strategies are used in conjunction with files being stored on the local filesystem in a shared symlinked storage folder. --- modules/system/classes/ImageResizer.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/system/classes/ImageResizer.php b/modules/system/classes/ImageResizer.php index ee3006d25..e5d463aca 100644 --- a/modules/system/classes/ImageResizer.php +++ b/modules/system/classes/ImageResizer.php @@ -219,9 +219,21 @@ class ImageResizer */ public function getConfig() { + $disk = $this->image['disk']; + + // Normalize local disk adapters with symlinked paths to their target path + // to support atomic deployments where the base application path changes + // each deployment but the realpath of the storage directory does not + if (FileHelper::isLocalDisk($disk)) { + $realPath = realpath($disk->getAdapter()->getPathPrefix()); + if ($realPath) { + $disk->getAdapter()->setPathPrefix($realPath); + } + } + $config = [ 'image' => [ - 'disk' => $this->image['disk'], + 'disk' => $disk, 'path' => $this->image['path'], 'source' => $this->image['source'], ],