From e068bcc76fe842fbcac8249ed29593f8a17b0c24 Mon Sep 17 00:00:00 2001 From: Dave Lawrence Date: Tue, 18 Dec 2012 15:17:52 -0500 Subject: Bug 813628 - New extension hook for Bugzilla::Bug::update called bug_start_of_update r/a=LpSolit --- Bugzilla/Bug.pm | 4 ++++ Bugzilla/Hook.pm | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) (limited to 'Bugzilla') diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index efad66f62..1f2b3cfea 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -791,6 +791,10 @@ sub update { my ($changes, $old_bug) = $self->SUPER::update(@_); + Bugzilla::Hook::process('bug_start_of_update', + { timestamp => $delta_ts, bug => $self, + old_bug => $old_bug, changes => $changes }); + # Certain items in $changes have to be fixed so that they hold # a name instead of an ID. foreach my $field (qw(product_id component_id)) { diff --git a/Bugzilla/Hook.pm b/Bugzilla/Hook.pm index 5ac07046e..4c8933b16 100644 --- a/Bugzilla/Hook.pm +++ b/Bugzilla/Hook.pm @@ -421,6 +421,39 @@ to the user. =back +=head2 bug_start_of_update + +This happens near the beginning of L, after L +is called, but before all other special changes are made to the database. Once use case is +this allows for adding your own entries to the C hash which gets added to the +bugs_activity table later keeping you from having to do it yourself. Also this is also helpful +if your extension needs to add CC members, flags, keywords, groups, etc. This generally +occurs inside a database transaction. + +Params: + +=over + +=item C + +The changed bug object, with all fields set to their updated values. + +=item C + +A bug object pulled from the database before the fields were set to +their updated values (so it has the old values available for each field). + +=item C + +The timestamp used for all updates in this transaction, as a SQL date +string. + +=item C + +The hash of changed fields. C<< $changes->{field} = [old, new] >> + +=back + =head2 bug_url_sub_classes Allows you to add more L sub-classes. -- cgit v1.2.3-24-g4f1b