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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ivan Ivlev
bugzilla
Commits
e9a2d105
Commit
e9a2d105
authored
Aug 20, 2008
by
mkanat%bugzilla.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 449306: Add a hook after a bug gets saved, and after flags get updated.
Patch By Jesse Clark <jjclark1982@gmail.com> r=mkanat, a=mkanat
parent
ef1385c2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
0 deletions
+58
-0
Bug.pm
Bugzilla/Bug.pm
+6
-0
Flag.pm
Bugzilla/Flag.pm
+7
-0
Hook.pm
Bugzilla/Hook.pm
+45
-0
No files found.
Bugzilla/Bug.pm
View file @
e9a2d105
...
...
@@ -35,6 +35,7 @@ use Bugzilla::Constants;
use
Bugzilla::
Field
;
use
Bugzilla::
Flag
;
use
Bugzilla::
FlagType
;
use
Bugzilla::
Hook
;
use
Bugzilla::
Keyword
;
use
Bugzilla::
User
;
use
Bugzilla::
Util
;
...
...
@@ -770,6 +771,11 @@ sub update {
$changes
->
{
'dup_id'
}
=
[
$old_dup
||
undef
,
$cur_dup
||
undef
];
}
Bugzilla::Hook::
process
(
'bug-end_of_update'
,
{
bug
=>
$self
,
timestamp
=>
$delta_ts
,
changes
=>
$changes
,
});
# If any change occurred, refresh the timestamp of the bug.
if
(
scalar
(
keys
%
$changes
)
||
$self
->
{
added_comments
})
{
$dbh
->
do
(
'UPDATE bugs SET delta_ts = ? WHERE bug_id = ?'
,
...
...
Bugzilla/Flag.pm
View file @
e9a2d105
...
...
@@ -54,6 +54,7 @@ whose names start with _ or a re specifically noted as being private.
=cut
use
Bugzilla::
FlagType
;
use
Bugzilla::
Hook
;
use
Bugzilla::
User
;
use
Bugzilla::
Util
;
use
Bugzilla::
Error
;
...
...
@@ -612,6 +613,12 @@ sub process {
my
@new_summaries
=
$class
->
snapshot
(
$bug_id
,
$attach_id
);
update_activity
(
$bug_id
,
$attach_id
,
$timestamp
,
\
@old_summaries
,
\
@new_summaries
);
Bugzilla::Hook::
process
(
'flag-end_of_update'
,
{
bug
=>
$bug
,
timestamp
=>
$timestamp
,
old_flags
=>
\
@old_summaries
,
new_flags
=>
\
@new_summaries
,
});
}
sub
update_activity
{
...
...
Bugzilla/Hook.pm
View file @
e9a2d105
...
...
@@ -207,6 +207,25 @@ This works just like L</auth-login_methods> except it's for
login verification methods (See L<Bugzilla::Auth::Verify>.) It also
takes a C<modules> parameter, just like L</auth-login_methods>.
=head2 bug-end_of_update
This happens at the end of L<Bugzilla::Bug/update>, after all other changes are
made to the database. This generally occurs inside a database transaction.
Params:
=over
=item C<bug> - The changed bug object, with all fields set to their updated
values.
=item C<timestamp> - The timestamp used for all updates in this transaction.
=item C<changes> - The hash of changed fields.
C<$changes-E<gt>{field} = [old, new]>
=back
=head2 buglist-columns
This happens in buglist.cgi after the standard columns have been defined and
...
...
@@ -308,6 +327,32 @@ Params:
=back
=head2 flag-end_of_update
This happens at the end of L<Bugzilla::Flag/process>, after all other changes
are made to the database and after emails are sent. It gives you a before/after
snapshot of flags so you can react to specific flag changes.
This generally occurs inside a database transaction.
Note that the interface to this hook is B<UNSTABLE> and it may change in the
future.
Params:
=over
=item C<bug> - The changed bug object.
=item C<timestamp> - The timestamp used for all updates in this transaction.
=item C<old_flags> - The snapshot of flag summaries from before the change.
=item C<new_flags> - The snapshot of flag summaries after the change. Call
C<my ($removed, $added) = diff_arrays(old_flags, new_flags)> to get the list of
changed flags, and search for a specific condition like C<added eq 'review-'>.
=back
=head2 install-requirements
Because of the way Bugzilla installation works, there can't be a normal
...
...
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