when using the database as media storage, magento checks wether or not the directories found in the database exist. unfortunately this checks goes wrong and it ends up creating folders just like the absolute path inside the wysiwyg folder.
magento 2.0.7
enable database media storage
click insert image
no uncessary folders are being created
unnecessary folders are being created (and never used)
Example:
if magento resides in /var/www/html and thus you have the folder /var/www/html/pub/media/wysiwyg magento will create the folder /var/www/html/pub/media/wysiwyg/var/www/html/pub/media/wysiwyg
Afaik the Problem lies in vendor/magento/module-cms/Model/Wysiwyg/Images/Storage.php in the method createSubDirectories($path) on line 199-201 a directory is supposed to create a path, but is given an absolute path, but the directory creates this relative to its own location, thus the wring result in the path
Does it cause any other problem than creating one redundant empty folder?
i just deleted my whole wysiwyg folder and now magento is unable to synch the files back from the database because the folders are missing, so its not just obsolete wrong folders but actually the ones magento needs are missing (what else would be the point of creating them in the first place)
tl;dr yes it breaks the media synch for cms/wysiwyg
my fix is this:
replace:
$fullPath = rtrim($path, '/') . '/' . $directory['name'];
$this->_directory->create($fullPath);
with:
$this->_directory->create($directory['path'].'/'.$directory['name']);
@ludwig-gramberg is it this issue? #5705
nope, this is something different
this appears to be fixed in 2.1.2 can someone form the magento team confirm this?
@ludwig-gramberg Unfortunately I could not reproduce this issue.
I need more information about this issue in order to successfully investigate potential fixes. Please use our issue tracking template to format your description. Specify the exact steps you used.
@IlnitskiyArtem well I did, the faulty behaviour is that a folder that is intended as an absolut path is created in relation to the existing media folder, thus creating faulty paths like this one:
/var/www/html/pub/media/wysiwyg/var/www/html/pub/media/wysiwyg
it repeats the absolute path within the media directory
@IlnitskiyArtem also as I wrote I did not observe this behaviour any more since version 2.1.2
I'm closing this issue as it is not reproduces any more.
If you can still reproduce this issue, please create a new GitHub issue report.