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
cd51ea19
Commit
cd51ea19
authored
Sep 01, 2010
by
Christian Legnitto
Committed by
Max Kanat-Alexander
Sep 01, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 587793: Add a new "object_end_of_create" hook so that extensions can
operate on any new objects r=mkanat, a=mkanat
parent
e2048ade
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
3 deletions
+37
-3
Hook.pm
Bugzilla/Hook.pm
+22
-2
Object.pm
Bugzilla/Object.pm
+6
-1
Extension.pm
extensions/Example/Extension.pm
+9
-0
No files found.
Bugzilla/Hook.pm
View file @
cd51ea19
...
...
@@ -210,8 +210,7 @@ Params:
=over
=item C<bug> - The changed bug object, with all fields set to their updated
values.
=item C<bug> - The created bug object.
=item C<timestamp> - The timestamp used for all updates in this transaction,
as a SQL date string.
...
...
@@ -821,6 +820,27 @@ or remove standard object columns using this hook.
=back
=head2 object_end_of_create
Called at the end of L<Bugzilla::Object/create>, after all other changes are
made to the database. This occurs inside a database transaction.
Params:
=over
=item C<class>
The name of the class that C<create> was called on. You can check this
like C<< if ($class->isa('Some::Class')) >> in your code, to perform specific
tasks for only certain classes.
=item C<object>
The created object.
=back
=head2 object_end_of_create_validators
Called at the end of L<Bugzilla::Object/run_create_validators>. You can
...
...
Bugzilla/Object.pm
View file @
cd51ea19
...
...
@@ -508,7 +508,12 @@ sub insert_create_data {
$dbh
->
do
(
"INSERT INTO $table ("
.
join
(
', '
,
@field_names
)
.
") VALUES ($qmarks)"
,
undef
,
@values
);
my
$id
=
$dbh
->
bz_last_key
(
$table
,
$class
->
ID_FIELD
);
return
$class
->
new
(
$id
);
my
$object
=
$class
->
new
(
$id
);
Bugzilla::Hook::
process
(
'object_end_of_create'
,
{
class
=>
$class
,
object
=>
$object
});
return
$object
;
}
sub
get_all
{
...
...
extensions/Example/Extension.pm
View file @
cd51ea19
...
...
@@ -408,6 +408,15 @@ sub object_columns {
}
}
sub
object_end_of_create
{
my
(
$self
,
$args
)
=
@_
;
my
$class
=
$args
->
{
'class'
};
my
$object
=
$args
->
{
'object'
};
warn
"Created a new $class object!"
;
}
sub
object_end_of_create_validators
{
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