From 2a222fef086f882413c3ec8700b637fecd17374c 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 1531a8793..27efd7c69 100644 --- a/scripts/composer/ScriptHandler.php +++ b/scripts/composer/ScriptHandler.php @@ -53,7 +53,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);