You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Warning: unlink(/data/web/magento2/magento/pub/media/): Is a directory in /data/web/magento2/magento/vendor/agencednd/module-pimgento/Product/Helper/Media.php on line 251
#194
Open
JensBourgeois opened this issue
Jun 26, 2018
· 5 comments
This warning is causing the import to fail.
Problem seems to be the following line in data/web/magento2/magento/vendor/agencednd/module-pimgento/Product/Model/Factory/Import/Media.php on line 410.
$imagePath = $this->image->getNewFile();
According to Magento the getNewFile() function is deprecated, but after some debugging it also seems this function is obsolete. So the variable $imagePath always returns NULL and breaks the code.
The text was updated successfully, but these errors were encountered:
I'm having this same issue. I did find that there's another issue raised at #181 that is the same. He presented a quick fix that I'm going to test out but any official feedback on this would be great. Thanks!
This repo seems to be dead to me. There are no updates, PR merge's whatsoever ...
Even if we got a PR for this .. Would it be ever merged?
Regarding this problem: it seems to be difficult to reproduce, in my environment it happens sometimes, sometimes not ..
Have you found any solution to this?
Not a PR (also, the repo is officially not supported anymore it seems), but this plugin code helped so the problem would not rise again if anyone is in need:
publicfunctionaroundDeleteMediaFile(\Pimgento\Product\Helper\Media$subject, callable$proceed, $filePath): void
{
if (!$filePath) {
return;
}
$absolutePath = rtrim($this->directoryList->getPath('media'), '/') . '/' . ltrim($filePath, '/');
// Change: Do not remove file if it's a directoryif (file_exists($absolutePath) && !is_dir($absolutePath)) {
unlink($absolutePath);
}
}
We are using Magento v2.2.3
This warning is causing the import to fail.
Problem seems to be the following line in data/web/magento2/magento/vendor/agencednd/module-pimgento/Product/Model/Factory/Import/Media.php on line 410.
$imagePath = $this->image->getNewFile();
According to Magento the getNewFile() function is deprecated, but after some debugging it also seems this function is obsolete. So the variable $imagePath always returns NULL and breaks the code.
The text was updated successfully, but these errors were encountered: