From 8762d1e68c4ea2343f445bb4beb46c1ae04586b1 Mon Sep 17 00:00:00 2001 From: Albert Ting Date: Thu, 8 Jan 2015 12:49:25 -0500 Subject: Bug 832095 - Request new buglist/query hooks --- Bugzilla/Hook.pm | 182 +++++++++++++++++++++++++++------------- buglist.cgi | 9 +- extensions/Example/Extension.pm | 23 +++++ query.cgi | 14 ++-- 4 files changed, 162 insertions(+), 66 deletions(-) diff --git a/Bugzilla/Hook.pm b/Bugzilla/Hook.pm index 430d5af49..5abaabc7c 100644 --- a/Bugzilla/Hook.pm +++ b/Bugzilla/Hook.pm @@ -57,11 +57,11 @@ Bugzilla::Hook - Extendable extension hooks for Bugzilla code =head1 DESCRIPTION -Bugzilla allows extension modules to drop in and add routines at +Bugzilla allows extension modules to drop in and add routines at arbitrary points in Bugzilla code. These points are referred to as hooks. When a piece of standard Bugzilla code wants to allow an extension to perform additional functions, it uses Bugzilla::Hook's L -subroutine to invoke any extension code if installed. +subroutine to invoke any extension code if installed. The implementation of extensions is described in L. @@ -98,7 +98,7 @@ mechanism. =item C<$name> - The name of the hook to invoke. -=item C<$args> - A hashref. The named args to pass to the hook. +=item C<$args> - A hashref. The named args to pass to the hook. They will be passed as arguments to the hook method in the extension. =back @@ -170,13 +170,13 @@ Params: =item C This is a hash--a mapping from login-type "names" to the actual module on -disk. The keys will be all the values that were passed to +disk. The keys will be all the values that were passed to L for the C parameter. The values are the actual path to the module on disk. (For example, if the key is C, the value is F.) -For your extension, the path will start with -F, where "Foo" is the name of your Extension. +For your extension, the path will start with +F, where "Foo" is the name of your Extension. (See the code in the example extension.) If your login type is in the hash as a key, you should set that key to the @@ -253,7 +253,7 @@ Params: =over -=item C +=item C The changed bug object, with all fields set to their updated values. @@ -262,12 +262,12 @@ The changed bug object, with all fields set to their updated values. 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 +=item C The timestamp used for all updates in this transaction, as a SQL date string. -=item C +=item C The hash of changed fields. C<< $changes->{field} = [old, new] >> @@ -276,9 +276,9 @@ The hash of changed fields. C<< $changes->{field} = [old, new] >> =head2 bug_check_can_change_field This hook controls what fields users are allowed to change. You can add code -here for site-specific policy changes and other customizations. +here for site-specific policy changes and other customizations. -This hook is only executed if the field's new and old values differ. +This hook is only executed if the field's new and old values differ. Any denies take priority over any allows. So, if another extension denies a change but yours allows the change, the other extension's deny will @@ -373,7 +373,7 @@ An arrayref of hashrefs. You should push a hashref containing two keys (C and C) in to this array. C is the regular expression that matches the text you want to replace, C is what you want to replace that -text with. (This gets passed into a regular expression like +text with. (This gets passed into a regular expression like C.) Instead of specifying a regular expression for C you can also @@ -394,7 +394,7 @@ do so could open a security hole in Bugzilla. A B to the exact text that you are parsing. -Generally you should not modify this yourself. Instead you should be +Generally you should not modify this yourself. Instead you should be returning regular expressions using the C array. The text has not been parsed in any way. (So, for example, it is not @@ -435,7 +435,7 @@ Params: =over -=item C +=item C The changed bug object, with all fields set to their updated values. @@ -444,12 +444,12 @@ The changed bug object, with all fields set to their updated values. 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 +=item C The timestamp used for all updates in this transaction, as a SQL date string. -=item C +=item C The hash of changed fields. C<< $changes->{field} = [old, new] >> @@ -509,7 +509,7 @@ Params: =over =item C - A hashref containing data to return back to -L. This hashref contains names of the columns as keys and +L. This hashref contains names of the columns as keys and a hashref about table to join as values. This hashref has the following keys: =over @@ -533,11 +533,38 @@ table should be joined with the C table. If omitted, LEFT is used. =back +=head2 buglist_format + +This happens in F, used to change the template variables before +processing the associated template hook. + +Params: + +=over + +=item C + +This is the entire set of variables that the current template +can see. + +=item C + +The name of the template file being processed. This is +relative to the main template directory for the language (i.e. for +F