Bugzilla::Hook - Extendible extension hooks for Bugzilla code
use Bugzilla::Hook; Bugzilla::Hook::process("hookname", { arg => $value, arg2 => $value2 });
Bugzilla allows extension modules to drop in and add routines at arbitrary points in Bugzilla code. These points are refered to as hooks. When a piece of standard Bugzilla code wants to allow an extension to perform additional functions, it uses Bugzilla::Hook's "process" subroutine to invoke any extension code if installed.
When a hook named HOOK_NAME
is run, Bugzilla will attempt to invoke any source files named extensions/*/code/HOOK_NAME.pl.
So, for example, if your extension is called "testopia", and you want to have code run during the "install-update_db" hook, you would have a file called extensions/testopia/code/install-update_db.pl that contained perl code to run during that hook.
Some hooks have params that are passed to them.
These params are accessible through "hook_args" in Bugzilla. That returns a hashref. Very frequently, if you want your hook to do anything, you have to modify these variables.
process
Invoke any code hooks with a matching name from any installed extensions.
See customization.xml
in the Bugzilla Guide for more information on Bugzilla's extension mechanism.
$name
- The name of the hook to invoke.
$args
- A hashref. The named args to pass to the hook. They will be accessible to the hook via "hook_args" in Bugzilla.This describes what hooks exist in Bugzilla currently.
This happens right before the template is loaded on enter_bug.cgi.
Params:
vars
- A hashref. The variables that will be passed into the template.This happens at the very end of all the tables being updated during an installation or upgrade. If you need to modify your custom schema, do it here. No params are passed.
This allows you to add tables to Bugzilla. Note that we recommend that you prefix the names of your tables with some word, so that they don't conflict with any future Bugzilla tables.
If you wish to add new columns to existing Bugzilla tables, do that in "install-update_db".
Params:
schema
- A hashref, in the format of "ABSTRACT_SCHEMA" in Bugzilla::DB::Schema. Add new hash keys to make new table definitions. checksetup.pl will automatically add these tables to the database when run.