[-] BO : Do not delete other default jpg when _deleteOldImages and type defined

This commit is contained in:
gRoussac
2013-10-29 10:57:33 +01:00
parent af61191a7e
commit 1bee84d26c
+3 -2
View File
@@ -438,10 +438,11 @@ class AdminImagesControllerCore extends AdminController
if (!is_dir($dir)) if (!is_dir($dir))
return false; return false;
$toDel = scandir($dir); $toDel = scandir($dir);
foreach ($toDel as $d) foreach ($toDel as $d)
foreach ($type as $imageType) foreach ($type as $imageType)
if (preg_match('/^[0-9]+\-'.($product ? '[0-9]+\-' : '').$imageType['name'].'\.jpg$/', $d) || preg_match('/^([[:lower:]]{2})\-default\-(.*)\.jpg$/', $d)) if (preg_match('/^[0-9]+\-'.($product ? '[0-9]+\-' : '').$imageType['name'].'\.jpg$/', $d) || preg_match('/^([[:lower:]]{2})\-default\-'.$imageType['name'].'\.jpg$/', $d))
if (file_exists($dir.$d)) if (file_exists($dir.$d))
unlink($dir.$d); unlink($dir.$d);
// delete product images using new filesystem. // delete product images using new filesystem.