Bug #779

avatar

Image deletion leaves image comments dangling

Added by delta kurshiva 28 days ago. Updated 25 days ago.

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

avatar

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 >_<

Updated by Shish Moom 28 days ago

avatar

test added in 2e24246, fix in 7d96035

leaving open until I can get home and run the full test suite to see that these changes actually work

Updated by Shish Moom 25 days ago

avatar
  • Status changed from New to Resolved

Testing is all green \o/

Also available in: Atom PDF