From c6d466b92615c42bf479eee3ebb655f5739ae6c4 Mon Sep 17 00:00:00 2001 From: SkywardRay <37404777+SkywardRay@users.noreply.github.com> Date: Wed, 15 Jan 2020 15:50:58 +0100 Subject: [PATCH] Update ScriptHandler.php to check for symlinks before creating files directory When using drupal inside a docker container it can be useful to make the sites/default/files directory a symlink instead. For example here in the wodby documentation https://wodby.com/docs/stacks/drupal/#files_1 I propose adding a check to is_link to prevent errors caused by $fs->exists not handling symlinks. --- scripts/composer/ScriptHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/composer/ScriptHandler.php b/scripts/composer/ScriptHandler.php index 51026d38a1..e818904f00 100644 --- a/scripts/composer/ScriptHandler.php +++ b/scripts/composer/ScriptHandler.php @@ -52,7 +52,7 @@ public static function createRequiredFiles(Event $event) { } // Create the files directory with chmod 0777 - if (!$fs->exists($drupalRoot . '/sites/default/files')) { + if (!$fs->exists($drupalRoot . '/sites/default/files') && !is_link($drupalRoot . '/sites/default/files')) { $oldmask = umask(0); $fs->mkdir($drupalRoot . '/sites/default/files', 0777); umask($oldmask);