Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
a9a869f8
Commit
a9a869f8
authored
Apr 02, 2010
by
Max Kanat-Alexander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 556869: New Hook: object_before_delete
r=mkanat, a=mkanat (module owner)
parent
07f947c9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
0 deletions
+32
-0
Hook.pm
Bugzilla/Hook.pm
+19
-0
Object.pm
Bugzilla/Object.pm
+1
-0
Extension.pm
extensions/Example/Extension.pm
+12
-0
No files found.
Bugzilla/Hook.pm
View file @
a9a869f8
...
...
@@ -704,6 +704,25 @@ A hashref. The set of named parameters passed to C<create>.
=back
=head2 object_before_delete
This happens in L<Bugzilla::Object/remove_from_db>, after we've confirmed
that the object can be deleted, but before any rows have actually
been removed from the database. This sometimes occurs inside a database
transaction.
Params:
=over
=item C<object> - The L<Bugzilla::Object> being deleted. You will probably
want to check its type like C<< $object->isa('Some::Class') >> before doing
anything with it.
=back
=head2 object_before_set
Called during L<Bugzilla::Object/set>, before any actual work is done.
...
...
Bugzilla/Object.pm
View file @
a9a869f8
...
...
@@ -383,6 +383,7 @@ sub update {
sub
remove_from_db
{
my
$self
=
shift
;
Bugzilla::Hook::
process
(
'object_before_delete'
,
{
object
=>
$self
});
my
$table
=
$self
->
DB_TABLE
;
my
$id_field
=
$self
->
ID_FIELD
;
Bugzilla
->
dbh
->
do
(
"DELETE FROM $table WHERE $id_field = ?"
,
...
...
extensions/Example/Extension.pm
View file @
a9a869f8
...
...
@@ -354,6 +354,18 @@ sub object_before_create {
}
}
sub
object_before_delete
{
my
(
$self
,
$args
)
=
@_
;
my
$object
=
$args
->
{
'object'
};
# Note that this is a made-up class, for this example.
if
(
$object
->
isa
(
'Bugzilla::ExampleObject'
))
{
my
$id
=
$object
->
id
;
warn
"An object with id $id is about to be deleted!"
;
}
}
sub
object_before_set
{
my
(
$self
,
$args
)
=
@_
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment