<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title> Bugzilla::Hook</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" title="style" type="text/css" href=".././../../../style.css" media="all" > </head> <body id="pod"> <p class="backlinktop"><b><a name="___top" href="../index.html" accesskey="1" title="All Documents"><<</a></b></p> <h1>Bugzilla::Hook</h1> <div class='indexgroup'> <ul class='indexList indexList1'> <li class='indexItem indexItem1'><a href='#NAME'>NAME</a> <li class='indexItem indexItem1'><a href='#SYNOPSIS'>SYNOPSIS</a> <li class='indexItem indexItem1'><a href='#DESCRIPTION'>DESCRIPTION</a> <ul class='indexList indexList2'> <li class='indexItem indexItem2'><a href='#How_Hooks_Work'>How Hooks Work</a> </ul> <li class='indexItem indexItem1'><a href='#SUBROUTINES'>SUBROUTINES</a> <li class='indexItem indexItem1'><a href='#HOOKS'>HOOKS</a> <ul class='indexList indexList2'> <li class='indexItem indexItem2'><a href='#admin_editusers_action'>admin_editusers_action</a> <li class='indexItem indexItem2'><a href='#attachment_process_data'>attachment_process_data</a> <li class='indexItem indexItem2'><a href='#auth_login_methods'>auth_login_methods</a> <li class='indexItem indexItem2'><a href='#auth_verify_methods'>auth_verify_methods</a> <li class='indexItem indexItem2'><a href='#bug_columns'>bug_columns</a> <li class='indexItem indexItem2'><a href='#bug_end_of_create'>bug_end_of_create</a> <li class='indexItem indexItem2'><a href='#bug_end_of_create_validators'>bug_end_of_create_validators</a> <li class='indexItem indexItem2'><a href='#bug_end_of_update'>bug_end_of_update</a> <li class='indexItem indexItem2'><a href='#bug_check_can_change_field'>bug_check_can_change_field</a> <li class='indexItem indexItem2'><a href='#bug_fields'>bug_fields</a> <li class='indexItem indexItem2'><a href='#bug_format_comment'>bug_format_comment</a> <li class='indexItem indexItem2'><a href='#bug_start_of_update'>bug_start_of_update</a> <li class='indexItem indexItem2'><a href='#bug_url_sub_classes'>bug_url_sub_classes</a> <li class='indexItem indexItem2'><a href='#buglist_columns'>buglist_columns</a> <li class='indexItem indexItem2'><a href='#buglist_column_joins'>buglist_column_joins</a> <li class='indexItem indexItem2'><a href='#search_operator_field_override'>search_operator_field_override</a> <li class='indexItem indexItem2'><a href='#bugmail_recipients'>bugmail_recipients</a> <li class='indexItem indexItem2'><a href='#bugmail_relationships'>bugmail_relationships</a> <li class='indexItem indexItem2'><a href='#config_add_panels'>config_add_panels</a> <li class='indexItem indexItem2'><a href='#config_modify_panels'>config_modify_panels</a> <li class='indexItem indexItem2'><a href='#email_in_before_parse'>email_in_before_parse</a> <li class='indexItem indexItem2'><a href='#email_in_after_parse'>email_in_after_parse</a> <li class='indexItem indexItem2'><a href='#enter_bug_entrydefaultvars'>enter_bug_entrydefaultvars</a> <li class='indexItem indexItem2'><a href='#error_catch'>error_catch</a> <li class='indexItem indexItem2'><a href='#flag_end_of_update'>flag_end_of_update</a> <li class='indexItem indexItem2'><a href='#group_before_delete'>group_before_delete</a> <li class='indexItem indexItem2'><a href='#group_end_of_create'>group_end_of_create</a> <li class='indexItem indexItem2'><a href='#group_end_of_update'>group_end_of_update</a> <li class='indexItem indexItem2'><a href='#install_before_final_checks'>install_before_final_checks</a> <li class='indexItem indexItem2'><a href='#install_filesystem'>install_filesystem</a> <li class='indexItem indexItem2'><a href='#install_update_db'>install_update_db</a> <li class='indexItem indexItem2'><a href='#install_update_db_fielddefs'>install_update_db_fielddefs</a> <li class='indexItem indexItem2'><a href='#db_schema_abstract_schema'>db_schema_abstract_schema</a> <li class='indexItem indexItem2'><a href='#job_map'>job_map</a> <li class='indexItem indexItem2'><a href='#mailer_before_send'>mailer_before_send</a> <li class='indexItem indexItem2'><a href='#object_before_create'>object_before_create</a> <li class='indexItem indexItem2'><a href='#object_before_delete'>object_before_delete</a> <li class='indexItem indexItem2'><a href='#object_before_set'>object_before_set</a> <li class='indexItem indexItem2'><a href='#object_columns'>object_columns</a> <li class='indexItem indexItem2'><a href='#object_end_of_create'>object_end_of_create</a> <li class='indexItem indexItem2'><a href='#object_end_of_create_validators'>object_end_of_create_validators</a> <li class='indexItem indexItem2'><a href='#object_end_of_set'>object_end_of_set</a> <li class='indexItem indexItem2'><a href='#object_end_of_set_all'>object_end_of_set_all</a> <li class='indexItem indexItem2'><a href='#object_end_of_update'>object_end_of_update</a> <li class='indexItem indexItem2'><a href='#object_update_columns'>object_update_columns</a> <li class='indexItem indexItem2'><a href='#object_validators'>object_validators</a> <li class='indexItem indexItem2'><a href='#page_before_template'>page_before_template</a> <li class='indexItem indexItem2'><a href='#path_info_whitelist'>path_info_whitelist</a> <li class='indexItem indexItem2'><a href='#post_bug_after_creation'>post_bug_after_creation</a> <li class='indexItem indexItem2'><a href='#product_confirm_delete'>product_confirm_delete</a> <li class='indexItem indexItem2'><a href='#product_end_of_create'>product_end_of_create</a> <li class='indexItem indexItem2'><a href='#quicksearch_map'>quicksearch_map</a> <li class='indexItem indexItem2'><a href='#sanitycheck_check'>sanitycheck_check</a> <li class='indexItem indexItem2'><a href='#sanitycheck_repair'>sanitycheck_repair</a> <li class='indexItem indexItem2'><a href='#template_before_create'>template_before_create</a> <li class='indexItem indexItem2'><a href='#template_before_process'>template_before_process</a> <li class='indexItem indexItem2'><a href='#user_preferences'>user_preferences</a> <li class='indexItem indexItem2'><a href='#webservice'>webservice</a> <li class='indexItem indexItem2'><a href='#webservice_error_codes'>webservice_error_codes</a> </ul> <li class='indexItem indexItem1'><a href='#SEE_ALSO'>SEE ALSO</a> </ul> </div> <h1><a class='u' href='#___top' title='click to go to top of document' name="NAME" >NAME</a></h1> <p>Bugzilla::Hook - Extendable extension hooks for Bugzilla code</p> <h1><a class='u' href='#___top' title='click to go to top of document' name="SYNOPSIS" >SYNOPSIS</a></h1> <pre class="code"> use Bugzilla::Hook; Bugzilla::Hook::process("hookname", { arg => $value, arg2 => $value2 });</pre> <h1><a class='u' href='#___top' title='click to go to top of document' name="DESCRIPTION" >DESCRIPTION</a></h1> <p>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 <a href="#process" class="podlinkpod" >"process"</a> subroutine to invoke any extension code if installed.</p> <p>The implementation of extensions is described in <a href="../Bugzilla/Extension.html" class="podlinkpod" >Bugzilla::Extension</a>.</p> <p>There is sample code for every hook in the Example extension, located in <em class="code">extensions/Example/Extension.pm</em>.</p> <h2><a class='u' href='#___top' title='click to go to top of document' name="How_Hooks_Work" >How Hooks Work</a></h2> <p>When a hook named <code class="code">HOOK_NAME</code> is run, Bugzilla looks through all enabled <a href="../Bugzilla/Extension.html" class="podlinkpod" >extensions</a> for extensions that implement a subroutine named <code class="code">HOOK_NAME</code>.</p> <p>See <a href="../Bugzilla/Extension.html" class="podlinkpod" >Bugzilla::Extension</a> for more details about how an extension can run code during a hook.</p> <h1><a class='u' href='#___top' title='click to go to top of document' name="SUBROUTINES" >SUBROUTINES</a></h1> <dl> <dt><a name="process" ><code class="code">process</code></a></dt> <dd> <dl> <dt><a name="Description" ><b>Description</b></a></dt> <dd> <p>Invoke any code hooks with a matching name from any installed extensions.</p> <p>See <a href="../Bugzilla/Extension.html" class="podlinkpod" >Bugzilla::Extension</a> for more information on Bugzilla's extension mechanism.</p> <dt><a name="Params" ><b>Params</b></a></dt> <dd> <dl> <dt><a name="$name_-_The_name_of_the_hook_to_invoke." ><code class="code">$name</code> - The name of the hook to invoke.</a></dt> <dd> <dt><a ><code class="code">$args</code> - A hashref. The named args to pass to the hook. They will be passed as arguments to the hook method in the extension.</a></dt> </dl> <dt><a name="Returns_(nothing)" ><b>Returns</b> (nothing)</a></dt> </dl> </dd> </dl> <h1><a class='u' href='#___top' title='click to go to top of document' name="HOOKS" >HOOKS</a></h1> <p>This describes what hooks exist in Bugzilla currently. They are mostly in alphabetical order, but some related hooks are near each other instead of being alphabetical.</p> <h2><a class='u' href='#___top' title='click to go to top of document' name="admin_editusers_action" >admin_editusers_action</a></h2> <p>This hook allows you to add additional actions to the admin Users page.</p> <p>Params:</p> <dl> <dt><a name="vars" ><code class="code">vars</code></a></dt> <dd> <p>You can add as many new key/value pairs as you want to this hashref. It will be passed to the template.</p> <dt><a name="action" ><code class="code">action</code></a></dt> <dd> <p>A text which indicates the different behaviors that editusers.cgi will have. With this hook you can change the behavior of an action or add new actions.</p> <dt><a name="user" ><code class="code">user</code></a></dt> <dd> <p>This is a Bugzilla::User object of the user.</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="attachment_process_data" >attachment_process_data</a></h2> <p>This happens at the very beginning process of the attachment creation. You can edit the attachment content itself as well as all attributes of the attachment, before they are validated and inserted into the DB.</p> <p>Params:</p> <dl> <dt><a ><code class="code">data</code> - A reference pointing either to the content of the file being uploaded or pointing to the filehandle associated with the file.</a></dt> <dd> <dt><a ><code class="code">attributes</code> - A hashref whose keys are the same as the input to <a href="../Bugzilla/Attachment.html#create" class="podlinkpod" >"create" in Bugzilla::Attachment</a>. The data in this hashref hasn't been validated yet.</a></dt> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="auth_login_methods" >auth_login_methods</a></h2> <p>This allows you to add new login types to Bugzilla. (See <a href="../Bugzilla/Auth/Login.html" class="podlinkpod" >Bugzilla::Auth::Login</a>.)</p> <p>Params:</p> <dl> <dt><a name="modules" ><code class="code">modules</code></a></dt> <dd> <p>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 <a href="../Bugzilla/Auth.html#login" class="podlinkpod" >"login" in Bugzilla::Auth</a> for the <code class="code">Login</code> parameter. The values are the actual path to the module on disk. (For example, if the key is <code class="code">DB</code>, the value is <em class="code">Bugzilla/Auth/Login/DB.pm</em>.)</p> <p>For your extension, the path will start with <em class="code">Bugzilla/Extension/Foo/</em>, where "Foo" is the name of your Extension. (See the code in the example extension.)</p> <p>If your login type is in the hash as a key, you should set that key to the right path to your module. That module's <code class="code">new</code> method will be called, probably with empty parameters. If your login type is <i>not</i> in the hash, you should not set it.</p> <p>You will be prevented from adding new keys to the hash, so make sure your key is in there before you modify it. (In other words, you can't add in login methods that weren't passed to <a href="../Bugzilla/Auth.html#login" class="podlinkpod" >"login" in Bugzilla::Auth</a>.)</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="auth_verify_methods" >auth_verify_methods</a></h2> <p>This works just like <a href="#auth_login_methods" class="podlinkpod" >"auth_login_methods"</a> except it's for login verification methods (See <a href="../Bugzilla/Auth/Verify.html" class="podlinkpod" >Bugzilla::Auth::Verify</a>.) It also takes a <code class="code">modules</code> parameter, just like <a href="#auth_login_methods" class="podlinkpod" >"auth_login_methods"</a>.</p> <h2><a class='u' href='#___top' title='click to go to top of document' name="bug_columns" >bug_columns</a></h2> <p><b>DEPRECATED</b> Use <a href="#object_columns" class="podlinkpod" >"object_columns"</a> instead.</p> <p>This allows you to add new fields that will show up in every <a href="../Bugzilla/Bug.html" class="podlinkpod" >Bugzilla::Bug</a> object. Note that you will also need to use the <a href="#bug_fields" class="podlinkpod" >"bug_fields"</a> hook in conjunction with this hook to make this work.</p> <p>Params:</p> <dl> <dt><a name="columns_-_An_arrayref_containing_an_array_of_column_names._Push_your_column_name(s)_onto_the_array." ><code class="code">columns</code> - An arrayref containing an array of column names. Push your column name(s) onto the array.</a></dt> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="bug_end_of_create" >bug_end_of_create</a></h2> <p>This happens at the end of <a href="../Bugzilla/Bug.html#create" class="podlinkpod" >"create" in Bugzilla::Bug</a>, after all other changes are made to the database. This occurs inside a database transaction.</p> <p>Params:</p> <dl> <dt><a name="bug_-_The_created_bug_object." ><code class="code">bug</code> - The created bug object.</a></dt> <dd> <dt><a name="timestamp_-_The_timestamp_used_for_all_updates_in_this_transaction,_as_a_SQL_date_string." ><code class="code">timestamp</code> - The timestamp used for all updates in this transaction, as a SQL date string.</a></dt> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="bug_end_of_create_validators" >bug_end_of_create_validators</a></h2> <p>This happens during <a href="../Bugzilla/Bug.html#create" class="podlinkpod" >"create" in Bugzilla::Bug</a>, after all parameters have been validated, but before anything has been inserted into the database.</p> <p>Params:</p> <dl> <dt><a name="params" ><code class="code">params</code></a></dt> <dd> <p>A hashref. The validated parameters passed to <code class="code">create</code>.</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="bug_end_of_update" >bug_end_of_update</a></h2> <p>This happens at the end of <a href="../Bugzilla/Bug.html#update" class="podlinkpod" >"update" in Bugzilla::Bug</a>, after all other changes are made to the database. This generally occurs inside a database transaction.</p> <p>Params:</p> <dl> <dt><a name="bug" ><code class="code">bug</code></a></dt> <dd> <p>The changed bug object, with all fields set to their updated values.</p> <dt><a name="old_bug" ><code class="code">old_bug</code></a></dt> <dd> <p>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).</p> <dt><a name="timestamp" ><code class="code">timestamp</code></a></dt> <dd> <p>The timestamp used for all updates in this transaction, as a SQL date string.</p> <dt><a name="changes" ><code class="code">changes</code></a></dt> <dd> <p>The hash of changed fields. <code class="code">$changes->{field} = [old, new]</code></p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="bug_check_can_change_field" >bug_check_can_change_field</a></h2> <p>This hook controls what fields users are allowed to change. You can add code here for site-specific policy changes and other customizations.</p> <p>This hook is only executed if the field's new and old values differ.</p> <p>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 override your extension's allow.</p> <p>Params:</p> <dl> <dt><a name="bug" ><code class="code">bug</code></a></dt> <dd> <p><a href="../Bugzilla/Bug.html" class="podlinkpod" >Bugzilla::Bug</a> - The current bug object that this field is changing on.</p> <dt><a name="field" ><code class="code">field</code></a></dt> <dd> <p>The name (from the <code class="code">fielddefs</code> table) of the field that we are checking.</p> <dt><a name="new_value" ><code class="code">new_value</code></a></dt> <dd> <p>The new value that the field is being changed to.</p> <dt><a name="old_value" ><code class="code">old_value</code></a></dt> <dd> <p>The old value that the field is being changed from.</p> <dt><a name="priv_results" ><code class="code">priv_results</code></a></dt> <dd> <p><code class="code">array</code> - This is how you explicitly allow or deny a change. You should only push something into this array if you want to explicitly allow or explicitly deny the change, and thus skip all other permission checks that would otherwise happen after this hook is called. If you don't care about the field change, then don't push anything into the array.</p> <p>The pushed value should be a choice from the following constants:</p> <dl> <dt><a name="PRIVILEGES_REQUIRED_NONE" ><code class="code">PRIVILEGES_REQUIRED_NONE</code></a></dt> <dd> <p>No privileges required. This explicitly <b>allows</b> a change.</p> <dt><a name="PRIVILEGES_REQUIRED_REPORTER" ><code class="code">PRIVILEGES_REQUIRED_REPORTER</code></a></dt> <dd> <p>User is not the reporter, assignee or an empowered user, so <b>deny</b>.</p> <dt><a name="PRIVILEGES_REQUIRED_ASSIGNEE" ><code class="code">PRIVILEGES_REQUIRED_ASSIGNEE</code></a></dt> <dd> <p>User is not the assignee or an empowered user, so <b>deny</b>.</p> <dt><a name="PRIVILEGES_REQUIRED_EMPOWERED" ><code class="code">PRIVILEGES_REQUIRED_EMPOWERED</code></a></dt> <dd> <p>User is not a sufficiently empowered user, so <b>deny</b>.</p> </dd> </dl> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="bug_fields" >bug_fields</a></h2> <p>Allows the addition of database fields from the bugs table to the standard list of allowable fields in a <a href="../Bugzilla/Bug.html" class="podlinkpod" >Bugzilla::Bug</a> object, so that you can call the field as a method.</p> <p>Note: You should add here the names of any fields you added in <a href="#bug_columns" class="podlinkpod" >"bug_columns"</a>.</p> <p>Params:</p> <dl> <dt><a name="columns_-_A_arrayref_containing_an_array_of_column_names._Push_your_column_name(s)_onto_the_array." ><code class="code">columns</code> - A arrayref containing an array of column names. Push your column name(s) onto the array.</a></dt> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="bug_format_comment" >bug_format_comment</a></h2> <p>Allows you to do custom parsing on comments before they are displayed. You do this by returning two regular expressions: one that matches the section you want to replace, and then another that says what you want to replace that match with.</p> <p>The matching and replacement will be run with the <code class="code">/g</code> switch on the regex.</p> <p>Params:</p> <dl> <dt><a name="regexes" ><code class="code">regexes</code></a></dt> <dd> <p>An arrayref of hashrefs.</p> <p>You should push a hashref containing two keys (<code class="code">match</code> and <code class="code">replace</code>) in to this array. <code class="code">match</code> is the regular expression that matches the text you want to replace, <code class="code">replace</code> is what you want to replace that text with. (This gets passed into a regular expression like <code class="code">s/$match/$replace/</code>.)</p> <p>Instead of specifying a regular expression for <code class="code">replace</code> you can also return a coderef (a reference to a subroutine). If you want to use backreferences (using <code class="code">$1</code>, <code class="code">$2</code>, etc. in your <code class="code">replace</code>), you have to use this method--it won't work if you specify <code class="code">$1</code>, <code class="code">$2</code> in a regular expression for <code class="code">replace</code>. Your subroutine will get a hashref as its only argument. This hashref contains a single key, <code class="code">matches</code>. <code class="code">matches</code> is an arrayref that contains <code class="code">$1</code>, <code class="code">$2</code>, <code class="code">$3</code>, etc. in order, up to <code class="code">$10</code>. Your subroutine should return what you want to replace the full <code class="code">match</code> with. (See the code example for this hook if you want to see how this actually all works in code. It's simpler than it sounds.)</p> <p><b>You are responsible for HTML-escaping your returned data.</b> Failing to do so could open a security hole in Bugzilla.</p> <dt><a name="text" ><code class="code">text</code></a></dt> <dd> <p>A <b>reference</b> to the exact text that you are parsing.</p> <p>Generally you should not modify this yourself. Instead you should be returning regular expressions using the <code class="code">regexes</code> array.</p> <p>The text has not been parsed in any way. (So, for example, it is not HTML-escaped. You get "&", not "&amp;".)</p> <dt><a name="bug" ><code class="code">bug</code></a></dt> <dd> <p>The <a href="../Bugzilla/Bug.html" class="podlinkpod" >Bugzilla::Bug</a> object that this comment is on. Sometimes this is <code class="code">undef</code>, meaning that we are parsing text that is not on a bug.</p> <dt><a name="comment" ><code class="code">comment</code></a></dt> <dd> <p>A <a href="../Bugzilla/Comment.html" class="podlinkpod" >Bugzilla::Comment</a> object representing the comment you are about to parse.</p> <p>Sometimes this is <code class="code">undef</code>, meaning that we are parsing text that is not a bug comment (but could still be some other part of a bug, like the summary line).</p> <dt><a name="user" ><code class="code">user</code></a></dt> <dd> <p>The <a href="../Bugzilla/User.html" class="podlinkpod" >Bugzilla::User</a> object representing the user who will see the text. This is useful to determine how much confidential information can be displayed to the user.</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="bug_start_of_update" >bug_start_of_update</a></h2> <p>This happens near the beginning of <a href="../Bugzilla/Bug.html#update" class="podlinkpod" >"update" in Bugzilla::Bug</a>, after <a href="../Bugzilla/Object.html#update" class="podlinkpod" >"update" in Bugzilla::Object</a> 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 <code class="code">changes</code> 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.</p> <p>Params:</p> <dl> <dt><a name="bug" ><code class="code">bug</code></a></dt> <dd> <p>The changed bug object, with all fields set to their updated values.</p> <dt><a name="old_bug" ><code class="code">old_bug</code></a></dt> <dd> <p>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).</p> <dt><a name="timestamp" ><code class="code">timestamp</code></a></dt> <dd> <p>The timestamp used for all updates in this transaction, as a SQL date string.</p> <dt><a name="changes" ><code class="code">changes</code></a></dt> <dd> <p>The hash of changed fields. <code class="code">$changes->{field} = [old, new]</code></p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="bug_url_sub_classes" >bug_url_sub_classes</a></h2> <p>Allows you to add more <a href="../Bugzilla/BugUrl.html" class="podlinkpod" >Bugzilla::BugUrl</a> sub-classes.</p> <p>See the <code class="code">MoreBugUrl</code> extension to see how things work.</p> <p>Params:</p> <dl> <dt><a name="sub_classes_-_An_arrayref_of_strings_which_represent_Bugzilla::BugUrl_sub-classes." ><code class="code">sub_classes</code> - An arrayref of strings which represent <a href="../Bugzilla/BugUrl.html" class="podlinkpod" >Bugzilla::BugUrl</a> sub-classes.</a></dt> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="buglist_columns" >buglist_columns</a></h2> <p>This happens in <a href="../Bugzilla/Search.html#COLUMNS" class="podlinkpod" >"COLUMNS" in Bugzilla::Search</a>, which determines legal bug list columns for <em class="code">buglist.cgi</em> and <em class="code">colchange.cgi</em>. It gives you the opportunity to add additional display columns.</p> <p>Params:</p> <dl> <dt><a ><code class="code">columns</code> - A hashref, where the keys are unique string identifiers for the column being defined and the values are hashrefs with the following fields:</a></dt> <dd> <dl> <dt><a name="name_-_The_name_of_the_column_in_the_database." ><code class="code">name</code> - The name of the column in the database.</a></dt> <dd> <dt><a name="title_-_The_title_of_the_column_as_displayed_to_users." ><code class="code">title</code> - The title of the column as displayed to users.</a></dt> </dl> <p>The definition is structured as:</p> <pre class="code"> $columns->{$id} = { name => $name, title => $title };</pre> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="buglist_column_joins" >buglist_column_joins</a></h2> <p>This allows you to join additional tables to display additional columns in buglists. This hook is generally used in combination with the <code class="code">buglist_columns</code> hook.</p> <p>Params:</p> <dl> <dt><a ><code class="code">column_joins</code> - A hashref containing data to return back to <a href="../Bugzilla/Search.html" class="podlinkpod" >Bugzilla::Search</a>. This hashref contains names of the columns as keys and a hashref about table to join as values. This hashref has the following keys:</a></dt> <dd> <dl> <dt><a name="table_-_The_name_of_the_additional_table_to_join." ><code class="code">table</code> - The name of the additional table to join.</a></dt> <dd> <dt><a ><code class="code">as</code> - (optional) The alias used for the additional table. This alias must not conflict with an existing alias already used in the query.</a></dt> <dd> <dt><a ><code class="code">from</code> - (optional) The name of the column in the <code class="code">bugs</code> table which the additional table should be linked to. If omitted, <code class="code">bug_id</code> will be used.</a></dt> <dd> <dt><a ><code class="code">to</code> - (optional) The name of the column in the additional table which should be linked to the column in the <code class="code">bugs</code> table, see <code class="code">from</code> above. If omitted, <code class="code">bug_id</code> will be used.</a></dt> <dd> <dt><a ><code class="code">join</code> - (optional) Either INNER or LEFT. Determine how the additional table should be joined with the <code class="code">bugs</code> table. If omitted, LEFT is used.</a></dt> </dl> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="search_operator_field_override" >search_operator_field_override</a></h2> <p>This allows you to modify <a href="../Bugzilla/Search.html#OPERATOR_FIELD_OVERRIDE" class="podlinkpod" >"OPERATOR_FIELD_OVERRIDE" in Bugzilla::Search</a>, which determines the search functions for fields. It allows you to specify custom search functionality for certain fields.</p> <p>See <a href="../Bugzilla/Search.html#OPERATOR_FIELD_OVERRIDE" class="podlinkpod" >"OPERATOR_FIELD_OVERRIDE" in Bugzilla::Search</a> for reference and see the code in the example extension.</p> <p>Note that the interface to this hook is <b>UNSTABLE</b> and it may change in the future.</p> <p>Params:</p> <dl> <dt><a name="operators_-_See_"OPERATOR_FIELD_OVERRIDE"_in_Bugzilla::Search_to_get_an_idea_of_the_structure." ><code class="code">operators</code> - See <a href="../Bugzilla/Search.html#OPERATOR_FIELD_OVERRIDE" class="podlinkpod" >"OPERATOR_FIELD_OVERRIDE" in Bugzilla::Search</a> to get an idea of the structure.</a></dt> <dd> <dt><a name="search_-_The_Bugzilla::Search_object." ><code class="code">search</code> - The <a href="../Bugzilla/Search.html" class="podlinkpod" >Bugzilla::Search</a> object.</a></dt> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="bugmail_recipients" >bugmail_recipients</a></h2> <p>This allows you to modify the list of users who are going to be receiving a particular bugmail. It also allows you to specify why they are receiving the bugmail.</p> <p>Users' bugmail preferences will be applied to any users that you add to the list. (So, for example, if you add somebody as though they were a CC on the bug, and their preferences state that they don't get email when they are a CC, they won't get email.)</p> <p>This hook is called before watchers or globalwatchers are added to the recipient list.</p> <p>Params:</p> <dl> <dt><a name="bug" ><code class="code">bug</code></a></dt> <dd> <p>The <a href="../Bugzilla/Bug.html" class="podlinkpod" >Bugzilla::Bug</a> that bugmail is being sent about.</p> <dt><a name="recipients" ><code class="code">recipients</code></a></dt> <dd> <p>This is a hashref. The keys are numeric user ids from the <code class="code">profiles</code> table in the database, for each user who should be receiving this bugmail. The values are hashrefs. The keys in <i>these</i> hashrefs correspond to the "relationship" that the user has to the bug they're being emailed about, and the value should always be <code class="code">1</code>. The "relationships" are described by the various <code class="code">REL_</code> constants in <a href="../Bugzilla/Constants.html" class="podlinkpod" >Bugzilla::Constants</a>.</p> <p>Here's an example of adding userid <code class="code">123</code> to the recipient list as though he were on the CC list:</p> <pre class="code"> $recipients->{123}->{+REL_CC} = 1</pre> <p>(We use <code class="code">+</code> in front of <code class="code">REL_CC</code> so that Perl interprets it as a constant instead of as a string.)</p> <dt><a name="users" ><code class="code">users</code></a></dt> <dd> <p>This is a hash of <a href="../Bugzilla/User.html" class="podlinkpod" >Bugzilla::User</a> objects, keyed by id. This is so you can find out more information about any of the user ids in the <code class="code">recipients</code> hash. Every id in the incoming <code class="code">recipients</code> hash will have an object in here. (But if you add additional recipients to the <code class="code">recipients</code> hash, you are <b>not</b> required to add them to this hash.)</p> <dt><a name="diffs" ><code class="code">diffs</code></a></dt> <dd> <p>This is a list of hashes, each hash representing a change to the bug. Each hash has the following members: <code class="code">field_name</code>, <code class="code">bug_when</code>, <code class="code">old</code>, <code class="code">new</code> and <code class="code">who</code> (a <a href="../Bugzilla/User.html" class="podlinkpod" >Bugzilla::User</a>). If appropriate, there will also be <code class="code">attach_id</code> or <code class="code">comment_id</code>; if either is present, there will be <code class="code">isprivate</code>. See <code class="code">_get_diffs</code> in <em class="code">Bugzilla/BugMail.pm</em> to see exactly how it is populated. Warning: the format and existence of the "diffs" parameter is subject to change in future releases of Bugzilla.</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="bugmail_relationships" >bugmail_relationships</a></h2> <p>There are various sorts of "relationships" that a user can have to a bug, such as Assignee, CC, etc. If you want to add a new type of relationship, you should use this hook.</p> <p>Params:</p> <dl> <dt><a name="relationships" ><code class="code">relationships</code></a></dt> <dd> <p>A hashref, where the keys are numbers and the values are strings.</p> <p>The keys represent a numeric identifier for the relationship. The numeric identifier should be a negative number between -1 and -127. The number must be unique across all extensions. (Negative numbers are used so as not to conflict with relationship identifiers in Bugzilla itself.)</p> <p>The value is the "name" of this relationship that will show up in email headers in bugmails. The "name" should be short and should contain no spaces.</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="config_add_panels" >config_add_panels</a></h2> <p>If you want to add new panels to the Parameters administrative interface, this is where you do it.</p> <p>Params:</p> <dl> <dt><a name="panel_modules" ><code class="code">panel_modules</code></a></dt> <dd> <p>A hashref, where the keys are the "name" of the panel and the value is the Perl module representing that panel. For example, if the name is <code class="code">Auth</code>, the value would be <code class="code">Bugzilla::Config::Auth</code>.</p> <p>For your extension, the Perl module would start with <code class="code">Bugzilla::Extension::Foo</code>, where "Foo" is the name of your Extension. (See the code in the example extension.)</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="config_modify_panels" >config_modify_panels</a></h2> <p>This is how you modify already-existing panels in the Parameters administrative interface. For example, if you wanted to add a new Auth method (modifying Bugzilla::Config::Auth) this is how you'd do it.</p> <p>Params:</p> <dl> <dt><a name="panels" ><code class="code">panels</code></a></dt> <dd> <p>A hashref, where the keys are lower-case panel "names" (like <code class="code">auth</code>, <code class="code">admin</code>, etc.) and the values are hashrefs. The hashref contains a single key, <code class="code">params</code>. <code class="code">params</code> is an arrayref--the return value from <code class="code">get_param_list</code> for that module. You can modify <code class="code">params</code> and your changes will be reflected in the interface.</p> <p>Adding new keys to <code class="code">panels</code> will have no effect. You should use <a href="#config_add_panels" class="podlinkpod" >"config_add_panels"</a> if you want to add new panels.</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="email_in_before_parse" >email_in_before_parse</a></h2> <p>This happens right after an inbound email is converted into an Email::MIME object, but before we start parsing the email to extract field data. This means the email has already been decoded for you. It gives you a chance to interact with the email itself before <a href="../email_in.html" class="podlinkpod" >email_in</a> starts parsing its content.</p> <dl> <dt><a name="mail_-_An_Email::MIME_object._The_decoded_incoming_email." ><code class="code">mail</code> - An Email::MIME object. The decoded incoming email.</a></dt> <dd> <dt><a name="fields_-_A_hashref._The_hash_which_will_contain_extracted_data." ><code class="code">fields</code> - A hashref. The hash which will contain extracted data.</a></dt> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="email_in_after_parse" >email_in_after_parse</a></h2> <p>This happens after all the data has been extracted from the email, but before the reporter is validated, during <a href="../email_in.html" class="podlinkpod" >email_in</a>. This lets you do things after the normal parsing of the email, such as sanitizing field data, changing the user account being used to file a bug, etc.</p> <dl> <dt><a name="fields_-_A_hashref._The_hash_containing_the_extracted_field_data." ><code class="code">fields</code> - A hashref. The hash containing the extracted field data.</a></dt> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="enter_bug_entrydefaultvars" >enter_bug_entrydefaultvars</a></h2> <p><b>DEPRECATED</b> - Use <a href="#template_before_process" class="podlinkpod" >"template_before_process"</a> instead.</p> <p>This happens right before the template is loaded on enter_bug.cgi.</p> <p>Params:</p> <dl> <dt><a name="vars_-_A_hashref._The_variables_that_will_be_passed_into_the_template." ><code class="code">vars</code> - A hashref. The variables that will be passed into the template.</a></dt> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="error_catch" >error_catch</a></h2> <p>This hook allows extensions to catch errors thrown by Bugzilla and take the appropriate actions.</p> <p>Params:</p> <dl> <dt><a name="error" ><code class="code">error</code></a></dt> <dd> <p>A string representing the error code thrown by Bugzilla. This string matches the <code class="code">error</code> variable in <code class="code">global/user-error.html.tmpl</code> and <code class="code">global/code-error.html.tmpl</code>.</p> <dt><a name="message" ><code class="code">message</code></a></dt> <dd> <p>If the error mode is set to <code class="code">ERROR_MODE_WEBPAGE</code>, you get a reference to the whole HTML page with the error message in it, including its header and footer. If you need to extract the error message itself, you can do it by looking at the content of the table cell whose ID is <code class="code">error_msg</code>. If the error mode is not set to <code class="code">ERROR_MODE_WEBPAGE</code>, you get a reference to the error message itself.</p> <dt><a name="vars" ><code class="code">vars</code></a></dt> <dd> <p>This hash contains all the data passed to the error template. Its content depends on the error thrown.</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="flag_end_of_update" >flag_end_of_update</a></h2> <p>This happens at the end of <a href="../Bugzilla/Flag.html#update_flags" class="podlinkpod" >"update_flags" in Bugzilla::Flag</a>, 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.</p> <p>Note that the interface to this hook is <b>UNSTABLE</b> and it may change in the future.</p> <p>Params:</p> <dl> <dt><a name="object_-_The_changed_bug_or_attachment_object." ><code class="code">object</code> - The changed bug or attachment object.</a></dt> <dd> <dt><a name="timestamp_-_The_timestamp_used_for_all_updates_in_this_transaction,_as_a_SQL_date_string." ><code class="code">timestamp</code> - The timestamp used for all updates in this transaction, as a SQL date string.</a></dt> <dd> <dt><a name="old_flags_-_The_snapshot_of_flag_summaries_from_before_the_change." ><code class="code">old_flags</code> - The snapshot of flag summaries from before the change.</a></dt> <dd> <dt><a ><code class="code">new_flags</code> - The snapshot of flag summaries after the change. Call <code class="code">my ($removed, $added) = diff_arrays(old_flags, new_flags)</code> to get the list of changed flags, and search for a specific condition like <code class="code">added eq 'review-'</code>.</a></dt> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="group_before_delete" >group_before_delete</a></h2> <p>This happens in <a href="../Bugzilla/Group.html#remove_from_db" class="podlinkpod" >"remove_from_db" in Bugzilla::Group</a>, after we've confirmed that the group can be deleted, but before any rows have actually been removed from the database. This occurs inside a database transaction.</p> <p>Params:</p> <dl> <dt><a name="group_-_The_Bugzilla::Group_being_deleted." ><code class="code">group</code> - The <a href="../Bugzilla/Group.html" class="podlinkpod" >Bugzilla::Group</a> being deleted.</a></dt> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="group_end_of_create" >group_end_of_create</a></h2> <p>This happens at the end of <a href="../Bugzilla/Group.html#create" class="podlinkpod" >"create" in Bugzilla::Group</a>, after all other changes are made to the database. This occurs inside a database transaction.</p> <p>Params:</p> <dl> <dt><a name="group" ><code class="code">group</code></a></dt> <dd> <p>The new <a href="../Bugzilla/Group.html" class="podlinkpod" >Bugzilla::Group</a> object that was just created.</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="group_end_of_update" >group_end_of_update</a></h2> <p>This happens at the end of <a href="../Bugzilla/Group.html#update" class="podlinkpod" >"update" in Bugzilla::Group</a>, after all other changes are made to the database. This occurs inside a database transaction.</p> <p>Params:</p> <dl> <dt><a name="group_-_The_changed_Bugzilla::Group_object,_with_all_fields_set_to_their_updated_values." ><code class="code">group</code> - The changed <a href="../Bugzilla/Group.html" class="podlinkpod" >Bugzilla::Group</a> object, with all fields set to their updated values.</a></dt> <dd> <dt><a name="changes_-_The_hash_of_changed_fields._$changes->{$field}_=_[$old,_$new]" ><code class="code">changes</code> - The hash of changed fields. <code class="code">$changes->{$field} = [$old, $new]</code></a></dt> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="install_before_final_checks" >install_before_final_checks</a></h2> <p>Allows execution of custom code before the final checks are done in checksetup.pl.</p> <p>Params:</p> <dl> <dt><a name="silent" ><code class="code">silent</code></a></dt> <dd> <p>A flag that indicates whether or not checksetup is running in silent mode. If this is true, messages that are <i>always</i> printed by checksetup.pl should be suppressed, but messages about any changes that are just being done this one time should be printed.</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="install_filesystem" >install_filesystem</a></h2> <p>Allows for additional files and directories to be added to the list of files and directories already managed by checksetup.pl. You will be able to also set permissions for the files and directories using this hook. You can also use this hook to create appropriate .htaccess files for any directory to secure its contents. For examples see <a href="../FILESYSTEM.html" class="podlinkpod" >FILESYSTEM</a> in <a href="../Bugzilla/Install/Filesystem.html" class="podlinkpod" >Bugzilla::Install::Filesystem</a>.</p> <p>Params:</p> <dl> <dt><a name="files" ><code class="code">files</code></a></dt> <dd> <p>Hash reference of files that are already present when your extension was installed but need to have specific permissions set. Each file key points to another hash reference containing the following settings.</p> <p>Params:</p> <dl> <dt><a name="perms_-_Permissions_to_be_set_on_the_file." ><code class="code">perms</code> - Permissions to be set on the file.</a></dt> </dl> <dt><a name="create_dirs" ><code class="code">create_dirs</code></a></dt> <dd> <p>Hash reference containing the name of each directory that will be created, pointing at its default permissions.</p> <dt><a name="non_recurse_dirs" ><code class="code">non_recurse_dirs</code></a></dt> <dd> <p>Hash reference containing directories that we want to set the perms on, but not recurse through. These are directories not created in checksetup.pl. Each directory key's value is the permissions to be set on the directory.</p> <dt><a name="recurse_dirs" ><code class="code">recurse_dirs</code></a></dt> <dd> <p>Hash reference of directories that will have permissions set for each item inside each of the directories, including the directory itself. Each directory key points to another hash reference containing the following settings.</p> <p>Params:</p> <dl> <dt><a name="files_-_Permissions_to_be_set_on_any_files_beneath_the_directory." ><code class="code">files</code> - Permissions to be set on any files beneath the directory.</a></dt> <dd> <dt><a name="dirs_-_Permissions_to_be_set_on_the_directory_itself_and_any_directories_beneath_it." ><code class="code">dirs</code> - Permissions to be set on the directory itself and any directories beneath it.</a></dt> </dl> <dt><a name="create_files" ><code class="code">create_files</code></a></dt> <dd> <p>Hash reference of additional files to be created. Each file key points to another hash reference containing the following settings.</p> <p>Params:</p> <dl> <dt><a name="perms_-_The_permissions_to_be_set_on_the_file_itself." ><code class="code">perms</code> - The permissions to be set on the file itself.</a></dt> <dd> <dt><a name="contents_-_The_contents_to_be_added_to_the_file_or_leave_blank_for_an_empty_file." ><code class="code">contents</code> - The contents to be added to the file or leave blank for an empty file.</a></dt> </dl> <dt><a name="htaccess" ><code class="code">htaccess</code></a></dt> <dd> <p>Hash reference containing htaccess files to be created. You can set the permissions for the htaccess as well as the contents of the file. Each file key points to another hash reference containing the following settings.</p> <p>Params:</p> <dl> <dt><a name="perms_-_Permissions_to_be_set_on_the_htaccess_file." ><code class="code">perms</code> - Permissions to be set on the htaccess file.</a></dt> <dd> <dt><a ><code class="code">contents</code> - Contents of the htaccess file. It can be set manually or use <a href="../HT_DEFAULT_DENY.html" class="podlinkpod" >HT_DEFAULT_DENY</a> defined in <a href="../Bugzilla/Install/Filesystem.html" class="podlinkpod" >Bugzilla::Install::Filesystem</a> to deny all by default.</a></dt> </dl> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="install_update_db" >install_update_db</a></h2> <p>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 or add new columns to existing tables, do it here. No params are passed.</p> <h2><a class='u' href='#___top' title='click to go to top of document' name="install_update_db_fielddefs" >install_update_db_fielddefs</a></h2> <p>This is used to update the schema of the fielddefs table before any other schema changes take place. No params are passed.</p> <p>This hook should only be used for updating the schema of the <code class="code">fielddefs</code> table. Do not modify any other table in this hook. To modify other tables, use the <a href="#install_update_db" class="podlinkpod" >"install_update_db"</a> hook.</p> <h2><a class='u' href='#___top' title='click to go to top of document' name="db_schema_abstract_schema" >db_schema_abstract_schema</a></h2> <p>This allows you to add tables to Bugzilla. Note that we recommend that you prefix the names of your tables with some word (preferably the name of your Extension), so that they don't conflict with any future Bugzilla tables.</p> <p>If you wish to add new <i>columns</i> to existing Bugzilla tables, do that in <a href="#install_update_db" class="podlinkpod" >"install_update_db"</a>.</p> <p>Params:</p> <dl> <dt><a ><code class="code">schema</code> - A hashref, in the format of <a href="../Bugzilla/DB/Schema.html#ABSTRACT_SCHEMA" class="podlinkpod" >"ABSTRACT_SCHEMA" in Bugzilla::DB::Schema</a>. Add new hash keys to make new table definitions. <em class="code">checksetup.pl</em> will automatically add these tables to the database when run.</a></dt> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="job_map" >job_map</a></h2> <p>Bugzilla has a system - <a href="../Bugzilla/JobQueue.html" class="podlinkpod" >Bugzilla::JobQueue</a> - for running jobs asynchronously, if the administrator has set it up. This hook allows the addition of mappings from job names to handler classes, so an extension can fire off jobs.</p> <p>Params:</p> <dl> <dt><a ><code class="code">job_map</code> - The job map hash. Key: the name of the job, as should be passed to Bugzilla->job_queue->insert(). Value: the name of the Perl module which implements the task (an instance of <a href="../TheSchwartz/Worker.html" class="podlinkpod" >TheSchwartz::Worker</a>).</a></dt> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="mailer_before_send" >mailer_before_send</a></h2> <p>Called right before <a href="../Bugzilla/Mailer.html" class="podlinkpod" >Bugzilla::Mailer</a> sends a message to the MTA.</p> <p>Params:</p> <dl> <dt><a name="email_-_The_Email::MIME_object_that's_about_to_be_sent." ><code class="code">email</code> - The <code class="code">Email::MIME</code> object that's about to be sent.</a></dt> <dd> <dt><a name="mailer_args_-_An_arrayref_that's_passed_as_mailer_args_to_"new"_in_Email::Send." ><code class="code">mailer_args</code> - An arrayref that's passed as <code class="code">mailer_args</code> to <a href="../Email/Send.html#new" class="podlinkpod" >"new" in Email::Send</a>.</a></dt> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="object_before_create" >object_before_create</a></h2> <p>This happens at the beginning of <a href="../Bugzilla/Object.html#create" class="podlinkpod" >"create" in Bugzilla::Object</a>.</p> <p>Params:</p> <dl> <dt><a name="class" ><code class="code">class</code></a></dt> <dd> <p>The name of the class that <code class="code">create</code> was called on. You can check this like <code class="code">if ($class->isa('Some::Class'))</code> in your code, to perform specific tasks before <code class="code">create</code> for only certain classes.</p> <dt><a name="params" ><code class="code">params</code></a></dt> <dd> <p>A hashref. The set of named parameters passed to <code class="code">create</code>.</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="object_before_delete" >object_before_delete</a></h2> <p>This happens in <a href="../Bugzilla/Object.html#remove_from_db" class="podlinkpod" >"remove_from_db" in Bugzilla::Object</a>, after we've confirmed that the object can be deleted, but before any rows have actually been removed from the database. This sometimes occurs inside a database transaction.</p> <p>Params:</p> <dl> <dt><a ><code class="code">object</code> - The <a href="../Bugzilla/Object.html" class="podlinkpod" >Bugzilla::Object</a> being deleted. You will probably want to check its type like <code class="code">$object->isa('Some::Class')</code> before doing anything with it.</a></dt> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="object_before_set" >object_before_set</a></h2> <p>Called during <a href="../Bugzilla/Object.html#set" class="podlinkpod" >"set" in Bugzilla::Object</a>, before any actual work is done. You can use this to perform actions before a value is changed for specific fields on certain types of objects.</p> <p>Params:</p> <dl> <dt><a name="object" ><code class="code">object</code></a></dt> <dd> <p>The object that <code class="code">set</code> was called on. You will probably want to do something like <code class="code">if ($object->isa('Some::Class'))</code> in your code to limit your changes to only certain subclasses of Bugzilla::Object.</p> <dt><a name="field" ><code class="code">field</code></a></dt> <dd> <p>The name of the field being updated in the object.</p> <dt><a name="value" ><code class="code">value</code></a></dt> <dd> <p>The value being set on the object.</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="object_columns" >object_columns</a></h2> <p>This hook allows you to add new "fields" to existing Bugzilla objects, that correspond to columns in their tables.</p> <p>For example, if you added an <code class="code">example</code> column to the "bugs" table, you would have to also add an <code class="code">example</code> field to the <code class="code">Bugzilla::Bug</code> object in order to access that data via Bug objects.</p> <p>Don't do anything slow inside this hook--it's called several times on every page of Bugzilla.</p> <p>Params:</p> <dl> <dt><a name="class" ><code class="code">class</code></a></dt> <dd> <p>The name of the class that this hook is being called on. You can check this like <code class="code">if ($class->isa('Some::Class'))</code> in your code, to add new fields only for certain classes.</p> <dt><a name="columns" ><code class="code">columns</code></a></dt> <dd> <p>An arrayref. Add the string names of columns to this array to add new values to objects.</p> <p>For example, if you add an <code class="code">example</code> column to a particular table (using <a href="#install_update_db" class="podlinkpod" >"install_update_db"</a>), and then push the string <code class="code">example</code> into this array for the object that uses that table, then you can access the information in that column via <code class="code">$object->{example}</code> on all objects of that type.</p> <p>This arrayref does not contain the standard column names--you cannot modify or remove standard object columns using this hook.</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="object_end_of_create" >object_end_of_create</a></h2> <p>Called at the end of <a href="../Bugzilla/Object.html#create" class="podlinkpod" >"create" in Bugzilla::Object</a>, after all other changes are made to the database. This occurs inside a database transaction.</p> <p>Params:</p> <dl> <dt><a name="class" ><code class="code">class</code></a></dt> <dd> <p>The name of the class that <code class="code">create</code> was called on. You can check this like <code class="code">if ($class->isa('Some::Class'))</code> in your code, to perform specific tasks for only certain classes.</p> <dt><a name="object" ><code class="code">object</code></a></dt> <dd> <p>The created object.</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="object_end_of_create_validators" >object_end_of_create_validators</a></h2> <p>Called at the end of <a href="../Bugzilla/Object.html#run_create_validators" class="podlinkpod" >"run_create_validators" in Bugzilla::Object</a>. You can use this to run additional validation when creating an object.</p> <p>If a subclass has overridden <code class="code">run_create_validators</code>, then this usually happens <i>before</i> the subclass does its custom validation.</p> <p>Params:</p> <dl> <dt><a name="class" ><code class="code">class</code></a></dt> <dd> <p>The name of the class that <code class="code">create</code> was called on. You can check this like <code class="code">if ($class->isa('Some::Class'))</code> in your code, to perform specific tasks for only certain classes.</p> <dt><a name="params" ><code class="code">params</code></a></dt> <dd> <p>A hashref. The set of named parameters passed to <code class="code">create</code>, modified and validated by the <code class="code">VALIDATORS</code> specified for the object.</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="object_end_of_set" >object_end_of_set</a></h2> <p>Called during <a href="../Bugzilla/Object.html#set" class="podlinkpod" >"set" in Bugzilla::Object</a>, after all the code of the function has completed (so the value has been validated and the field has been set to the new value). You can use this to perform actions after a value is changed for specific fields on certain types of objects.</p> <p>The new value is not specifically passed to this hook because you can get it as <code class="code">$object->{$field}</code>.</p> <p>Params:</p> <dl> <dt><a name="object" ><code class="code">object</code></a></dt> <dd> <p>The object that <code class="code">set</code> was called on. You will probably want to do something like <code class="code">if ($object->isa('Some::Class'))</code> in your code to limit your changes to only certain subclasses of Bugzilla::Object.</p> <dt><a name="field" ><code class="code">field</code></a></dt> <dd> <p>The name of the field that was updated in the object.</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="object_end_of_set_all" >object_end_of_set_all</a></h2> <p>This happens at the end of <a href="../Bugzilla/Object.html#set_all" class="podlinkpod" >"set_all" in Bugzilla::Object</a>. This is a good place to call custom set_ functions on objects, or to make changes to an object before <code class="code">update()</code> is called.</p> <p>Params:</p> <dl> <dt><a name="object" ><code class="code">object</code></a></dt> <dd> <p>The <a href="../Bugzilla/Object.html" class="podlinkpod" >Bugzilla::Object</a> which is being updated. You will probably want to do something like <code class="code">if ($object->isa('Some::Class'))</code> in your code to limit your changes to only certain subclasses of Bugzilla::Object.</p> <dt><a name="params" ><code class="code">params</code></a></dt> <dd> <p>A hashref. The set of named parameters passed to <code class="code">set_all</code>.</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="object_end_of_update" >object_end_of_update</a></h2> <p>Called during <a href="../Bugzilla/Object.html#update" class="podlinkpod" >"update" in Bugzilla::Object</a>, after changes are made to the database, but while still inside a transaction.</p> <p>Params:</p> <dl> <dt><a name="object" ><code class="code">object</code></a></dt> <dd> <p>The object that <code class="code">update</code> was called on. You will probably want to do something like <code class="code">if ($object->isa('Some::Class'))</code> in your code to limit your changes to only certain subclasses of Bugzilla::Object.</p> <dt><a name="old_object" ><code class="code">old_object</code></a></dt> <dd> <p>The object as it was before it was updated.</p> <dt><a name="changes" ><code class="code">changes</code></a></dt> <dd> <p>The fields that have been changed, in the same format that <a href="../Bugzilla/Object.html#update" class="podlinkpod" >"update" in Bugzilla::Object</a> returns.</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="object_update_columns" >object_update_columns</a></h2> <p>If you've added fields to bugs via <a href="#object_columns" class="podlinkpod" >"object_columns"</a>, then this hook allows you to say which of those columns should be updated in the database when <a href="../Bugzilla/Object.html#update" class="podlinkpod" >"update" in Bugzilla::Object</a> is called on the object.</p> <p>If you don't use this hook, then your custom columns won't be modified in the database by Bugzilla.</p> <p>Params:</p> <dl> <dt><a name="object" ><code class="code">object</code></a></dt> <dd> <p>The object that is about to be updated. You should check this like <code class="code">if ($object->isa('Some::Class'))</code> in your code, to modify the "update columns" only for certain classes.</p> <dt><a name="columns" ><code class="code">columns</code></a></dt> <dd> <p>An arrayref. Add the string names of columns to this array to allow that column to be updated when <code class="code">update()</code> is called on the object.</p> <p>This arrayref does not contain the standard column names--you cannot stop standard columns from being updated by using this hook.</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="object_validators" >object_validators</a></h2> <p>Allows you to add new items to <a href="../Bugzilla/Object.html#VALIDATORS" class="podlinkpod" >"VALIDATORS" in Bugzilla::Object</a> for particular classes.</p> <p>Params:</p> <dl> <dt><a name="class" ><code class="code">class</code></a></dt> <dd> <p>The name of the class that <code class="code">VALIDATORS</code> was called on. You can check this like <code class="code">if ($class->isa('Some::Class'))</code> in your code, to add validators only for certain classes.</p> <dt><a name="validators" ><code class="code">validators</code></a></dt> <dd> <p>A hashref, where the keys are database columns and the values are subroutine references. You can add new validators or modify existing ones. If you modify an existing one, you should remember to call the original validator inside of your modified validator. (This way, several extensions can all modify the same validator.)</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="page_before_template" >page_before_template</a></h2> <p>This is a simple way to add your own pages to Bugzilla. This hooks <code class="code">page.cgi</code>, which loads templates from <em class="code">template/en/default/pages</em>. For example, <code class="code">page.cgi?id=fields.html</code> loads <em class="code">template/en/default/pages/fields.html.tmpl</em>.</p> <p>This hook is called right before the template is loaded, so that you can pass your own variables to your own pages.</p> <p>You can also use this to implement complex custom pages, by doing your own output and then calling <code class="code">exit</code> at the end of the hook, thus preventing the normal <code class="code">page.cgi</code> behavior from occurring.</p> <p>Params:</p> <dl> <dt><a name="page_id" ><code class="code">page_id</code></a></dt> <dd> <p>This is the name of the page being loaded, like <code class="code">fields.html</code>.</p> <p>Note that if two extensions use the same name, it is uncertain which will override the others, so you should be careful with how you name your pages. Usually extensions prefix their pages with a directory named after their extension, so for an extension named "Foo", page ids usually look like <code class="code">foo/mypage.html</code>.</p> <dt><a name="vars" ><code class="code">vars</code></a></dt> <dd> <p>This is a hashref--put variables into here if you want them passed to your template.</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="path_info_whitelist" >path_info_whitelist</a></h2> <p>By default, Bugzilla removes the Path-Info information from URLs before passing data to CGI scripts. If this information is needed for your customizations, you can enumerate the pages you want to whitelist here.</p> <p>Params:</p> <dl> <dt><a name="whitelist" ><code class="code">whitelist</code></a></dt> <dd> <p>An array of script names that will not have their Path-Info automatically removed.</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="post_bug_after_creation" >post_bug_after_creation</a></h2> <p><b>DEPRECATED</b> (Use <a href="#bug_end_of_create" class="podlinkpod" >"bug_end_of_create"</a> instead.)</p> <p>This happens after a bug is created and before bug mail is sent during <code class="code">post_bug.cgi</code>. Note that this only happens during <code class="code">post_bug.cgi</code>, it doesn't happen during any of the other methods of creating a bug.</p> <p>Params:</p> <dl> <dt><a name="vars_-_The_template_vars_hashref." ><code class="code">vars</code> - The template vars hashref.</a></dt> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="product_confirm_delete" >product_confirm_delete</a></h2> <p><b>DEPRECATED</b> - Use <a href="#template_before_process" class="podlinkpod" >"template_before_process"</a> instead.</p> <p>Called before displaying the confirmation message when deleting a product.</p> <p>Params:</p> <dl> <dt><a name="vars_-_The_template_vars_hashref." ><code class="code">vars</code> - The template vars hashref.</a></dt> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="product_end_of_create" >product_end_of_create</a></h2> <p>Called right after a new product has been created, allowing additional changes to be made to the new product's attributes. This occurs inside of a database transaction, so if the hook throws an error, all previous changes will be rolled back, including the creation of the new product. (However, note that such rollbacks should not normally be used, as some databases that Bugzilla supports have very bad rollback performance. If you want to validate input and throw errors before the Product is created, use <a href="#object_end_of_create_validators" class="podlinkpod" >"object_end_of_create_validators"</a> instead, or add a validator using <a href="#object_validators" class="podlinkpod" >"object_validators"</a>.)</p> <p>Params:</p> <dl> <dt><a name="product_-_The_new_Bugzilla::Product_object_that_was_just_created." ><code class="code">product</code> - The new <a href="../Bugzilla/Product.html" class="podlinkpod" >Bugzilla::Product</a> object that was just created.</a></dt> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="quicksearch_map" >quicksearch_map</a></h2> <p>This hook allows you to alter the Quicksearch syntax to include e.g. special searches for custom fields you have.</p> <p>Params:</p> <dl> <dt><a ><code class="code">map</code> - a hash where the key is the name you want to use in Quicksearch, and the value is the name from the <code class="code">fielddefs</code> table that you want it to map to. You can modify existing mappings or add new ones.</a></dt> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="sanitycheck_check" >sanitycheck_check</a></h2> <p>This hook allows for extra sanity checks to be added, for use by <em class="code">sanitycheck.cgi</em>.</p> <p>Params:</p> <dl> <dt><a name="status_-_a_CODEREF_that_allows_status_messages_to_be_displayed_to_the_user._(sanitycheck.cgi's_Status)" ><code class="code">status</code> - a CODEREF that allows status messages to be displayed to the user. (<em class="code">sanitycheck.cgi</em>'s <code class="code">Status</code>)</a></dt> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="sanitycheck_repair" >sanitycheck_repair</a></h2> <p>This hook allows for extra sanity check repairs to be made, for use by <em class="code">sanitycheck.cgi</em>.</p> <p>Params:</p> <dl> <dt><a name="status_-_a_CODEREF_that_allows_status_messages_to_be_displayed_to_the_user._(sanitycheck.cgi's_Status)" ><code class="code">status</code> - a CODEREF that allows status messages to be displayed to the user. (<em class="code">sanitycheck.cgi</em>'s <code class="code">Status</code>)</a></dt> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="template_before_create" >template_before_create</a></h2> <p>This hook allows you to modify the configuration of <a href="../Bugzilla/Template.html" class="podlinkpod" >Bugzilla::Template</a> objects before they are created. For example, you could add a new global template variable this way.</p> <p>Params:</p> <dl> <dt><a name="config" ><code class="code">config</code></a></dt> <dd> <p>A hashref--the configuration that will be passed to <a href="../Template.html#new" class="podlinkpod" >"new" in Template</a>. See <a href="http://template-toolkit.org/docs/modules/Template.html#section_CONFIGURATION_SUMMARY" class="podlinkurl" >http://template-toolkit.org/docs/modules/Template.html#section_CONFIGURATION_SUMMARY</a> for information on how this configuration variable is structured (or just look at the code for <code class="code">create</code> in <a href="../Bugzilla/Template.html" class="podlinkpod" >Bugzilla::Template</a>.)</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="template_before_process" >template_before_process</a></h2> <p>This hook is called any time Bugzilla processes a template file, including calls to <code class="code">$template->process</code>, <code class="code">PROCESS</code> statements in templates, and <code class="code">INCLUDE</code> statements in templates. It is not called when templates process a <code class="code">BLOCK</code>, only when they process a file.</p> <p>This hook allows you to define additional variables that will be available to the template being processed, or to modify the variables that are currently in the template. It works exactly as though you inserted code to modify template variables at the top of a template.</p> <p>You probably want to restrict this hook to operating only if a certain file is being processed (which is why you get a <code class="code">file</code> argument below). Otherwise, modifying the <code class="code">vars</code> argument will affect every single template in Bugzilla.</p> <p><b>Note:</b> This hook is not called if you are already in this hook. (That is, it won't call itself recursively.) This prevents infinite recursion in situations where this hook needs to process a template (such as if this hook throws an error).</p> <p>Params:</p> <dl> <dt><a name="vars" ><code class="code">vars</code></a></dt> <dd> <p>This is the entire set of variables that the current template can see. Technically, this is a <a href="../Template/Stash.html" class="podlinkpod" >Template::Stash</a> object, but you can just use it like a hashref if you want.</p> <dt><a name="file" ><code class="code">file</code></a></dt> <dd> <p>The name of the template file being processed. This is relative to the main template directory for the language (i.e. for <em class="code">template/en/default/bug/show.html.tmpl</em>, this variable will contain <code class="code">bug/show.html.tmpl</code>).</p> <dt><a name="context" ><code class="code">context</code></a></dt> <dd> <p>A <a href="../Template/Context.html" class="podlinkpod" >Template::Context</a> object. Usually you will not have to use this, but if you need information about the template itself (other than just its name), you can get it from here.</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="user_preferences" >user_preferences</a></h2> <p>This hook allows you to add additional panels to the User Preferences page, and validate data displayed and returned from these panels. It works in combination with the <code class="code">tabs</code> hook available in the <em class="code">template/en/default/account/prefs/prefs.html.tmpl</em> template. To make it work, you must define two templates in your extension: <em class="code">extensions/Foo/template/en/default/hook/account/prefs/prefs-tabs.html.tmpl</em> contains a list of additional panels to include. <em class="code">extensions/Foo/template/en/default/account/prefs/bar.html.tmpl</em> contains the content of the panel itself. See the <code class="code">Example</code> extension to see how things work.</p> <p>Params:</p> <dl> <dt><a name="current_tab" ><code class="code">current_tab</code></a></dt> <dd> <p>The name of the current panel being viewed by the user. You should always make sure that the name of the panel matches what you expect it to be. Else you could be interacting with the panel of another extension.</p> <dt><a name="save_changes" ><code class="code">save_changes</code></a></dt> <dd> <p>A boolean which is true when data should be validated and the DB updated accordingly. This means the user clicked the "Submit Changes" button.</p> <dt><a name="handled" ><code class="code">handled</code></a></dt> <dd> <p>This is a <b>reference</b> to a scalar, not a scalar. (So you would set it like <code class="code">$$handled = 1</code>, not like <code class="code">$handled = 1</code>.) Set this to a true value to let Bugzilla know that the passed-in panel is valid and that you have handled it. (Otherwise, Bugzilla will throw an error that the panel is invalid.) Don't set this to true if you didn't handle the panel listed in <code class="code">current_tab</code>.</p> <dt><a name="vars" ><code class="code">vars</code></a></dt> <dd> <p>You can add as many new key/value pairs as you want to this hashref. It will be passed to the template.</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="webservice" >webservice</a></h2> <p>This hook allows you to add your own modules to the WebService. (See <a href="../Bugzilla/WebService.html" class="podlinkpod" >Bugzilla::WebService</a>.)</p> <p>Params:</p> <dl> <dt><a name="dispatch" ><code class="code">dispatch</code></a></dt> <dd> <p>A hashref where you can specify the names of your modules and which Perl module handles the functions for that module. (This is actually sent to <a href="../SOAP/Lite.html#dispatch_with" class="podlinkpod" >"dispatch_with" in SOAP::Lite</a>. You can see how that's used in <em class="code">xmlrpc.cgi</em>.)</p> <p>The Perl module name will most likely start with <code class="code">Bugzilla::Extension::Foo::</code> (where "Foo" is the name of your extension).</p> <p>Example:</p> <pre class="code"> $dispatch->{'Example.Blah'} = "Bugzilla::Extension::Example::Webservice::Blah";</pre> <p>And then you'd have a module <em class="code">extensions/Example/lib/Webservice/Blah.pm</em>, and could call methods from that module like <code class="code">Example.Blah.Foo()</code> using the WebServices interface.</p> <p>It's recommended that all the keys you put in <code class="code">dispatch</code> start with the name of your extension, so that you don't conflict with the standard Bugzilla WebService functions (and so that you also don't conflict with other plugins).</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="webservice_error_codes" >webservice_error_codes</a></h2> <p>If your webservice extension throws custom errors, you can set numeric codes for those errors here.</p> <p>Extensions should use error codes above 10000, unless they are re-using an already-existing error code.</p> <p>Params:</p> <dl> <dt><a name="error_map" ><code class="code">error_map</code></a></dt> <dd> <p>A hash that maps the names of errors (like <code class="code">invalid_param</code>) to numbers. See <a href="../Bugzilla/WebService/Constants.html#WS_ERROR_CODE" class="podlinkpod" >"WS_ERROR_CODE" in Bugzilla::WebService::Constants</a> for an example.</p> </dd> </dl> <h1><a class='u' href='#___top' title='click to go to top of document' name="SEE_ALSO" >SEE ALSO</a></h1> <p><a href="../Bugzilla/Extension.html" class="podlinkpod" >Bugzilla::Extension</a></p> <p class="backlinkbottom"><b><a name="___bottom" href="../index.html" title="All Documents"><<</a></b></p> <!-- end doc --> </body></html>