cancel
Showing results for 
Search instead for 
Did you mean: 

Allow symlinks for folders that should be created if they don't exist

0 Kudos

Allow symlinks for folders that should be created if they don't exist

If you use \Magento\Framework\Filesystem\Directory\Write::create() and the to-be-created directory is a symlink, the creation fails with an exception.
In my opinion \Magento\Framework\Filesystem\Driver\File should implement a function isLink() with function usage of is_link() and the create() function should check for
if ($this->driver->isDirectory($absolutePath) || $this->driver->isLink($absolutePath))

In our use case, a media subdirectory should be created, but already exists as a symlink to an external drive. In this case the function should not break.

 

--

 

Use case:

In our case pub/media/catalog/product is a symlink to an external drive.
If you execute bin/magento setup:upgrade, the upgrade fails with the message that it cannot create the directory.
The check if the directory needs to be created should check if it's a symlink and if yes, do not try to create it as it exists.

 

(Support request 349912)