Bug #779
Image deletion leaves image comments dangling
| Status: | Resolved | Start: | 10/23/2009 | |
| Priority: | High | Due date: | ||
| Assigned to: | - | % Done: | 0% |
|
| Category: | default extensions | |||
| Target version: | 2.3 | |||
Description
As far as I can tell, in the current trunk image deletion does not properly clean up after itself. This in turn leads to /comment/list not being displayable.
It's pretty obvious:
/ext/comment/main.php, line 163 ff.:
public function onImageDeletion($event) {
global $database;
$database->Execute("DELETE FROM comments WHERE image_id=?", array($image_id));
log_info("comment", "Deleting all comments for Image #$image_id");
}
$image_id does not exist in that function. Changing it to:
public function onImageDeletion($event) {
global $database;
$image_id = $event->image->id;
$database->Execute("DELETE FROM comments WHERE image_id=?", array($image_id));
log_info("comment", "Deleting all comments for Image #$image_id");
}
does the trick.
History
Updated by Shish Moom 28 days ago
Aha, I was wondering where that came from -- somehow I only noticed it happening when testing with SQLite, so I was studying the SQLite specific code >_<