I think your fix will break some contributions, espcially the Export/Import module.
An image file can be shared by more than one image_id in the database. In fact, each image (as per the auto-
increment of the image_id) can be described in the database by its filename and its title. For instance, several
categories can share the same physical image file name (e.g. folder.png), with different titles.
Hence, before you delete the physical image file, make sure that no other image_id uses the same name in
the database! Your proposed fix at http://code.google.com/p/open-cart/source/detail?r=185 should therefore be updated
to take this into account.
In file /admin/controller/image.php replace the old fix
Code: Select all
...
$result = $database->getRows("select * from image where image_id = '" . (int)$request->get('image_id') . "'");
$result = array_shift($result);
$image->delete($result['filename']);
$database->query("delete from image where image_id = '" . (int)$request->get('image_id') . "'");
...
Code: Select all
...
$result = $database->getRows("select * from image where image_id = '" . (int)$request->get('image_id') . "'");
$result = array_shift($result);
$filename = $result['filename'];
$rows = $database->getRows("select filename from image where filename=$filename");
if (count($rows) <= 1) {
$image->delete($filename);
}
$database->query("delete from image where image_id = '" . (int)$request->get('image_id') . "'");
...