Sophie

Sophie

distrib > Mageia > 7 > i586 > by-pkgid > 4e237fd705495e1e21ef20696443e053 > files > 1005

bugzilla-5.0.4-3.mga7.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>
Bugzilla</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">&lt;&lt;</a></b></p>
<h1>Bugzilla</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>
  <li class='indexItem indexItem1'><a href='#METHODS'>METHODS</a>
  <li class='indexItem indexItem1'><a href='#CACHING'>CACHING</a>
  <li class='indexItem indexItem1'><a href='#Methods_in_need_of_POD'>Methods in need of POD</a>
</ul>
</div>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="NAME"
>NAME</a></h1>

<p>Bugzilla - Semi-persistent collection of various objects used by scripts and modules</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;

  sub someModulesSub {
    Bugzilla-&#62;dbh-&#62;prepare(...);
    Bugzilla-&#62;template-&#62;process(...);
  }</pre>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="DESCRIPTION"
>DESCRIPTION</a></h1>

<p>Several Bugzilla &#39;things&#39; are used by a variety of modules and scripts. This includes database handles, template objects, and so on.</p>

<p>This module is a singleton intended as a central place to store these objects. This approach has several advantages:</p>

<ul>
<li>They&#39;re not global variables, so we don&#39;t have issues with them staying around with mod_perl</li>

<li>Everything is in one central place, so it&#39;s easy to access, modify, and maintain</li>

<li>Code in modules can get access to these objects without having to have them all passed from the caller, and the caller&#39;s caller, and....</li>

<li>We can reuse objects across requests using mod_perl where appropriate (eg templates), whilst destroying those which are only valid for a single request (such as the current user)</li>
</ul>

<p>Note that items accessible via this object are demand-loaded when requested.</p>

<p>For something to be added to this object, it should either be able to benefit from persistence when run under mod_perl (such as the a <code  class="code">template</code> object), or should be something which is globally required by a large ammount of code (such as the current <code  class="code">user</code> object).</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="METHODS"
>METHODS</a></h1>

<p>Note that all <code  class="code">Bugzilla</code> functionality is method based; use <code  class="code">Bugzilla-&#62;dbh</code> rather than <code  class="code">Bugzilla::dbh</code>. Nothing cares about this now, but don&#39;t rely on that.</p>

<dl>
<dt><a name="template"
><code  class="code">template</code></a></dt>

<dd>
<p>The current <code  class="code">Template</code> object, to be used for output</p>

<dt><a name="template_inner"
><code  class="code">template_inner</code></a></dt>

<dd>
<p>If you ever need a <a href="./Bugzilla/Template.html" class="podlinkpod"
>Bugzilla::Template</a> object while you&#39;re already processing a template, use this. Also use it if you want to specify the language to use. If no argument is passed, it uses the last language set. If the argument is &#34;&#34; (empty string), the language is reset to the current one (the one used by <code  class="code">Bugzilla-&#62;template</code>).</p>

<dt><a name="cgi"
><code  class="code">cgi</code></a></dt>

<dd>
<p>The current <code  class="code">cgi</code> object. Note that modules should <b>not</b> be using this in general. Not all Bugzilla actions are cgi requests. Its useful as a convenience method for those scripts/templates which are only use via CGI, though.</p>

<dt><a name="input_params"
><code  class="code">input_params</code></a></dt>

<dd>
<p>When running under the WebService, this is a hashref containing the arguments passed to the WebService method that was called. When running in a normal script, this is a hashref containing the contents of the CGI parameters.</p>

<p>Modifying this hashref will modify the CGI parameters or the WebService arguments (depending on what <code  class="code">input_params</code> currently represents).</p>

<p>This should be used instead of <a href="#cgi" class="podlinkpod"
>&#34;cgi&#34;</a> in situations where your code could be being called by either a normal CGI script or a WebService method, such as during a code hook.</p>

<p><b>Note:</b> When <code  class="code">input_params</code> represents the CGI parameters, any parameter specified more than once (like <code  class="code">foo=bar&#38;foo=baz</code>) will appear as an arrayref in the hash, but any value specified only once will appear as a scalar. This means that even if a value <i>can</i> appear multiple times, if it only <i>does</i> appear once, then it will be a scalar in <code  class="code">input_params</code>, not an arrayref.</p>

<dt><a name="user"
><code  class="code">user</code></a></dt>

<dd>
<p>Default <code  class="code">Bugzilla::User</code> object if there is no currently logged in user or if the login code has not yet been run. If an sudo session is in progress, the <code  class="code">Bugzilla::User</code> corresponding to the person who is being impersonated. If no session is in progress, the current <code  class="code">Bugzilla::User</code>.</p>

<dt><a name="set_user"
><code  class="code">set_user</code></a></dt>

<dd>
<p>Allows you to directly set what <a href="#user" class="podlinkpod"
>&#34;user&#34;</a> will return. You can use this if you want to bypass <a href="#login" class="podlinkpod"
>&#34;login&#34;</a> for some reason and directly &#34;log in&#34; a specific <a href="./Bugzilla/User.html" class="podlinkpod"
>Bugzilla::User</a>. Be careful with it, though!</p>

<dt><a name="sudoer"
><code  class="code">sudoer</code></a></dt>

<dd>
<p><code  class="code">undef</code> if there is no currently logged in user, the currently logged in user is not in the <i>sudoer</i> group, or there is no session in progress. If an sudo session is in progress, returns the <code  class="code">Bugzilla::User</code> object corresponding to the person who logged in and initiated the session. If no session is in progress, returns the <code  class="code">Bugzilla::User</code> object corresponding to the currently logged in user.</p>

<dt><a 
><code  class="code">sudo_request</code> This begins an sudo session for the current request. It is meant to be used when a session has just started. For normal use, sudo access should normally be set at login time.</a></dt>

<dd>
<dt><a name="login"
><code  class="code">login</code></a></dt>

<dd>
<p>Logs in a user, returning a <code  class="code">Bugzilla::User</code> object, or <code  class="code">undef</code> if there is no logged in user. See <a href="./Bugzilla/Auth.html" class="podlinkpod"
>Bugzilla::Auth</a>, and <a href="./Bugzilla/User.html" class="podlinkpod"
>Bugzilla::User</a>.</p>

<dt><a name="page_requires_login"
><code  class="code">page_requires_login</code></a></dt>

<dd>
<p>If the current page always requires the user to log in (for example, <code  class="code">enter_bug.cgi</code> or any page called with <code  class="code">?GoAheadAndLogIn=1</code>) then this will return something true. Otherwise it will return false. (This is set when you call <a href="#login" class="podlinkpod"
>&#34;login&#34;</a>.)</p>

<dt><a name="logout($option)"
><code  class="code">logout($option)</code></a></dt>

<dd>
<p>Logs out the current user, which involves invalidating user sessions and cookies. Three options are available from <a href="./Bugzilla/Constants.html" class="podlinkpod"
>Bugzilla::Constants</a>: LOGOUT_CURRENT (the default), LOGOUT_ALL or LOGOUT_KEEP_CURRENT.</p>

<dt><a name="logout_user($user)"
><code  class="code">logout_user($user)</code></a></dt>

<dd>
<p>Logs out the specified user (invalidating all their sessions), taking a Bugzilla::User instance.</p>

<dt><a name="logout_by_id($id)"
><code  class="code">logout_by_id($id)</code></a></dt>

<dd>
<p>Logs out the user with the id specified. This is a compatibility function to be used in callsites where there is only a userid and no Bugzilla::User instance.</p>

<dt><a name="logout_request"
><code  class="code">logout_request</code></a></dt>

<dd>
<p>Essentially, causes calls to <code  class="code">Bugzilla-&#62;user</code> to return <code  class="code">undef</code>. This has the effect of logging out a user for the current request only; cookies and database sessions are left intact.</p>

<dt><a name="fields"
><code  class="code">fields</code></a></dt>

<dd>
<p>This is the standard way to get arrays or hashes of <a href="./Bugzilla/Field.html" class="podlinkpod"
>Bugzilla::Field</a> objects when you need them. It takes the following named arguments in a hashref:</p>

<dl>
<dt><a name="by_name"
><code  class="code">by_name</code></a></dt>

<dd>
<p>If false (or not specified), this method will return an arrayref of the requested fields.</p>

<p>If true, this method will return a hashref of fields, where the keys are field names and the valules are <a href="./Bugzilla/Field.html" class="podlinkpod"
>Bugzilla::Field</a> objects.</p>

<dt><a name="type"
><code  class="code">type</code></a></dt>

<dd>
<p>Either a single <code  class="code">FIELD_TYPE_*</code> constant or an arrayref of them. If specified, the returned fields will be limited to the types in the list. If you don&#39;t specify this argument, all fields will be returned.</p>
</dd>
</dl>

<dt><a name="error_mode"
><code  class="code">error_mode</code></a></dt>

<dd>
<p>Call either <code  class="code">Bugzilla-&#62;error_mode(Bugzilla::Constants::ERROR_MODE_DIE)</code> or <code  class="code">Bugzilla-&#62;error_mode(Bugzilla::Constants::ERROR_MODE_DIE_SOAP_FAULT)</code> to change this flag&#39;s default of <code  class="code">Bugzilla::Constants::ERROR_MODE_WEBPAGE</code> and to indicate that errors should be passed to error mode specific error handlers rather than being sent to a browser and finished with an exit().</p>

<p>This is useful, for example, to keep <code  class="code">eval</code> blocks from producing wild HTML on errors, making it easier for you to catch them. (Remember to reset the error mode to its previous value afterwards, though.)</p>

<p><code  class="code">Bugzilla-&#62;error_mode</code> will return the current state of this flag.</p>

<p>Note that <code  class="code">Bugzilla-&#62;error_mode</code> is being called by <code  class="code">Bugzilla-&#62;usage_mode</code> on usage mode changes.</p>

<dt><a name="usage_mode"
><code  class="code">usage_mode</code></a></dt>

<dd>
<p>Call either <code  class="code">Bugzilla-&#62;usage_mode(Bugzilla::Constants::USAGE_MODE_CMDLINE)</code> or <code  class="code">Bugzilla-&#62;usage_mode(Bugzilla::Constants::USAGE_MODE_XMLRPC)</code> near the beginning of your script to change this flag&#39;s default of <code  class="code">Bugzilla::Constants::USAGE_MODE_BROWSER</code> and to indicate that Bugzilla is being called in a non-interactive manner.</p>

<p>This influences error handling because on usage mode changes, <code  class="code">usage_mode</code> calls <code  class="code">Bugzilla-&#62;error_mode</code> to set an error mode which makes sense for the usage mode.</p>

<p><code  class="code">Bugzilla-&#62;usage_mode</code> will return the current state of this flag.</p>

<dt><a name="installation_mode"
><code  class="code">installation_mode</code></a></dt>

<dd>
<p>Determines whether or not installation should be silent. See <a href="./Bugzilla/Constants.html" class="podlinkpod"
>Bugzilla::Constants</a> for the <code  class="code">INSTALLATION_MODE</code> constants.</p>

<dt><a name="installation_answers"
><code  class="code">installation_answers</code></a></dt>

<dd>
<p>Returns a hashref representing any &#34;answers&#34; file passed to <em  class="code">checksetup.pl</em>, used to automatically answer or skip prompts.</p>

<dt><a name="dbh"
><code  class="code">dbh</code></a></dt>

<dd>
<p>The current database handle. See <a href="./DBI.html" class="podlinkpod"
>DBI</a>.</p>

<dt><a name="dbh_main"
><code  class="code">dbh_main</code></a></dt>

<dd>
<p>The main database handle. See <a href="./DBI.html" class="podlinkpod"
>DBI</a>.</p>

<dt><a name="languages"
><code  class="code">languages</code></a></dt>

<dd>
<p>Currently installed languages. Returns a reference to a list of RFC 1766 language tags of installed languages.</p>

<dt><a name="current_language"
><code  class="code">current_language</code></a></dt>

<dd>
<p>The currently active language.</p>

<dt><a name="switch_to_shadow_db"
><code  class="code">switch_to_shadow_db</code></a></dt>

<dd>
<p>Switch from using the main database to using the shadow database.</p>

<dt><a name="switch_to_main_db"
><code  class="code">switch_to_main_db</code></a></dt>

<dd>
<p>Change the database object to refer to the main database.</p>

<dt><a name="is_shadow_db"
><code  class="code">is_shadow_db</code></a></dt>

<dd>
<p>Returns true if the currently active database is the shadow database. Returns false if a the currently active database is the man database, or if a shadow database is not configured or enabled.</p>

<dt><a name="params"
><code  class="code">params</code></a></dt>

<dd>
<p>The current Parameters of Bugzilla, as a hashref. If <code  class="code">data/params.json</code> does not exist, then we return an empty hashref. If <code  class="code">data/params.json</code> is unreadable or is not valid, we <code  class="code">die</code>.</p>

<dt><a name="local_timezone"
><code  class="code">local_timezone</code></a></dt>

<dd>
<p>Returns the local timezone of the Bugzilla installation, as a DateTime::TimeZone object. This detection is very time consuming, so we cache this information for future references.</p>

<dt><a name="job_queue"
><code  class="code">job_queue</code></a></dt>

<dd>
<p>Returns a <a href="./Bugzilla/JobQueue.html" class="podlinkpod"
>Bugzilla::JobQueue</a> that you can use for queueing jobs. Will throw an error if job queueing is not correctly configured on this Bugzilla installation.</p>

<dt><a name="feature"
><code  class="code">feature</code></a></dt>

<dd>
<p>Tells you whether or not a specific feature is enabled. For names of features, see <code  class="code">OPTIONAL_MODULES</code> in <code  class="code">Bugzilla::Install::Requirements</code>.</p>
</dd>
</dl>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="CACHING"
><b>CACHING</b></a></h1>

<p>Bugzilla has several different caches available which provide different capabilities and lifetimes.</p>

<p>The keys of all caches are unregulated; use of prefixes is suggested to avoid collisions.</p>

<dl>
<dt><a name="Request_Cache"
><b>Request Cache</b></a></dt>

<dd>
<p>The request cache is a hashref which supports caching any perl variable for the duration of the current request. At the end of the current request the contents of this cache are cleared.</p>

<p>Examples of its use include caching objects to avoid re-fetching the same data from the database, and passing data between otherwise unconnected parts of Bugzilla.</p>

<dl>
<dt><a name="request_cache"
><code  class="code">request_cache</code></a></dt>

<dd>
<p>Returns a hashref which can be checked and modified to store any perl variable for the duration of the current request.</p>

<dt><a name="clear_request_cache"
><code  class="code">clear_request_cache</code></a></dt>

<dd>
<p>Removes all entries from the <code  class="code">request_cache</code>.</p>
</dd>
</dl>

<dt><a name="Process_Cache"
><b>Process Cache</b></a></dt>

<dd>
<p>The process cache is a hashref which support caching of any perl variable. If Bugzilla is configured to run using Apache mod_perl, the contents of this cache are persisted across requests for the lifetime of the Apache worker process (which varies depending on the SizeLimit configuration in mod_perl.pl).</p>

<p>If Bugzilla isn&#39;t running under mod_perl, the process cache&#39;s contents are cleared at the end of the request.</p>

<p>The process cache is only suitable for items which never change while Bugzilla is running (for example the path where Bugzilla is installed).</p>

<dl>
<dt><a name="process_cache"
><code  class="code">process_cache</code></a></dt>

<dd>
<p>Returns a hashref which can be checked and modified to store any perl variable for the duration of the current process (mod_perl) or request (mod_cgi).</p>
</dd>
</dl>

<dt><a name="Memcached"
><b>Memcached</b></a></dt>

<dd>
<p>If Memcached is installed and configured, Bugzilla can use it to cache data across requests and between webheads. Unlike the request and process caches, only scalars, hashrefs, and arrayrefs can be stored in Memcached.</p>

<p>Memcached integration is only required for large installations of Bugzilla -- if you have multiple webheads then configuring Memcached is recommended.</p>

<dl>
<dt><a name="memcached"
><code  class="code">memcached</code></a></dt>

<dd>
<p>Returns a <code  class="code">Bugzilla::Memcached</code> object. An object is always returned even if Memcached is not available.</p>

<p>See the documentation for the <code  class="code">Bugzilla::Memcached</code> module for more information.</p>
</dd>
</dl>
</dd>
</dl>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="Methods_in_need_of_POD"
><b>Methods in need of POD</b></a></h1>

<dl>
<dt><a name="init_page"
>init_page</a></dt>

<dd>
<dt><a name="extensions"
>extensions</a></dt>

<dd>
<dt><a name="logout_user_by_id"
>logout_user_by_id</a></dt>

<dd>
<dt><a name="localconfig"
>localconfig</a></dt>

<dd>
<dt><a name="active_custom_fields"
>active_custom_fields</a></dt>

<dd>
<dt><a name="has_flags"
>has_flags</a></dt>
</dl>
<p class="backlinkbottom"><b><a name="___bottom" href="index.html" title="All Documents">&lt;&lt;</a></b></p>

<!-- end doc -->

</body></html>