Closed
Bug 679516
Opened 13 years ago
Closed 13 years ago
Use Bugzilla::Object's remove_from_db when deleting any object
Categories
(Bugzilla :: Administration, task)
Bugzilla
Administration
Tracking
()
RESOLVED
FIXED
Bugzilla 4.4
People
(Reporter: edmundhyan, Assigned: edmundhyan)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 2 obsolete files)
1.55 KB,
patch
|
LpSolit
:
review+
|
Details | Diff | Splinter Review |
Not all objects, when deleted, are using Bugzilla::Object's remove_from_db() method. This is part of the goal to audit every deletion in Bugzilla, bug 641428. In addition, this allows users to use the object_before_delete extension hook when any object is deleted. Component.pm has already been fixed in bug 675366. This bug deals with all other objects.
Comment 1•13 years ago
|
||
Let's fix them all at once, please. No need to file one bug per module.
Assignee | ||
Comment 2•13 years ago
|
||
This patch fixes the remove_from_db() of the following: Bugzilla::Products Bugzilla::Field Bugzilla::Milestone There is one object left that is not fixed, and that is Bugzilla::Attachment. Although it uses a method called remove_from_db(), it's somewhat of a misnomer. The file is indeed deleted from the database, but a record is kept in the 'attachments' table and marked obsolete.
Attachment #553598 -
Flags: review?(mkanat)
Attachment #553598 -
Flags: review?(LpSolit)
Assignee | ||
Comment 3•13 years ago
|
||
After talking to LpSolit on irc I am adding the clean-up of Bugzilla::Status as part of one patch dealing with remove_from_db() in general.
Attachment #553598 -
Attachment is obsolete: true
Attachment #553598 -
Flags: review?(mkanat)
Attachment #553598 -
Flags: review?(LpSolit)
Attachment #553605 -
Flags: review?(LpSolit)
Comment 4•13 years ago
|
||
Comment on attachment 553605 [details] [diff] [review] Patch for Products, Field, Milestone, and Status >=== modified file 'Bugzilla/Status.pm' > my $id = $self->id; $id is no longer in use. > $dbh->bz_start_transaction(); > $self->SUPER::remove_from_db(); > $dbh->bz_commit_transaction(); We don't need a transaction for this single line. Bugzilla::Object already does it for us. Just call remove_from_db. Otherwise looks good.
Attachment #553605 -
Flags: review?(LpSolit) → review-
Assignee | ||
Comment 5•13 years ago
|
||
Attachment #553605 -
Attachment is obsolete: true
Attachment #553611 -
Flags: review?(LpSolit)
Comment 6•13 years ago
|
||
Comment on attachment 553611 [details] [diff] [review] Patch for Products, Field, Milestone, and Status >=== modified file 'Bugzilla/Status.pm' > sub remove_from_db { > my $self = shift; > my $dbh = Bugzilla->dbh; > $self->SUPER::remove_from_db(); > delete Bugzilla->request_cache->{status_bug_state_open}; > } $dbh is unused. No need to define it. This line should be removed on checkin. r=LpSolit
Attachment #553611 -
Flags: review?(LpSolit) → review+
Updated•13 years ago
|
Assignee: administration → edmundhyan
Status: NEW → ASSIGNED
Flags: approval+
Comment 7•13 years ago
|
||
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/ modified Bugzilla/Field.pm modified Bugzilla/Milestone.pm modified Bugzilla/Product.pm modified Bugzilla/Status.pm Committed revision 7938.
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•