5.7.45. Bugzilla::Install::Util

5.7.45.1. NAME

Bugzilla::Install::Util - Utility functions that are useful both during installation and afterwards.

5.7.45.2. DESCRIPTION

This module contains various subroutines that are used primarily during installation. However, these subroutines can also be useful to non-installation code, so they have been split out into this module.

The difference between this module and Bugzilla::Util is that this module is safe to use anywhere in Bugzilla, even during installation, because it depends only on Bugzilla::Constants and built-in perl modules.

None of the subroutines are exported by default--you must explicitly export them.

5.7.45.3. SUBROUTINES

bin_loc

On *nix systems, given the name of a binary, returns the path to that binary, if the binary is in the PATH.

get_version_and_os

Returns a hash containing information about what version of Bugzilla we're running, what perl version we're using, and what OS we're running on.

get_console_locale

Returns the language to use based on the LC_CTYPE value returned by the OS. If LC_CTYPE is of the form fr-CH, then fr is appended to the list.

init_console

Sets the ANSI_COLORS_DISABLED and HTTP_ACCEPT_LANGUAGE environment variables.

indicate_progress

Description

This prints out lines of dots as a long update is going on, to let the user know where we are and that we're not frozen. A new line of dots will start every 60 dots.

Sample usage: indicate_progress({ total => $total, current => $count, every => 1 })

Sample Output

Here's some sample output with total = 1000 and every = 10:

............................................................600/1000 (60%)
........................................

Params

total - The total number of items we're processing.

current - The number of the current item we're processing.

every - How often the function should print out a dot. For example, if this is 10, the function will print out a dot every ten items. Defaults to 1 if not specified.

Returns: nothing

install_string

Description

This is a very simple method of templating strings for installation. It should only be used by code that has to run before the Template Toolkit can be used. (See the comments at the top of the various Bugzilla::Install modules to find out when it's safe to use Template Toolkit.)

It pulls strings out of the strings.txt.pl "template" and replaces any variable surrounded by double-hashes (##) with a value you specify.

This allows for localization of strings used during installation.

Example

Let's say your template string looks like this:

The ##animal## jumped over the ##plant##.

Let's say that string is called 'animal_jump_plant'. So you call the function like this:

install_string('animal_jump_plant', { animal => 'fox', plant => 'tree' });

That will output this:

The fox jumped over the tree.

Params

$string_id - The name of the string from strings.txt.pl.

$vars - A hashref containing the replacement values for variables inside of the string.

Returns: The appropriate string, with variables replaced.

template_include_path

Used by Bugzilla::Template and `install_string`_ to determine the directories where templates are installed. Templates can be installed in many places. They're listed here in the basic order that they're searched:

extensions/$extension/template/$language/$project

extensions/$extension/template/$language/custom

extensions/$extension/template/$language/default

template/$language/$project

template/$language/custom

template/$language/default

$project has to do with installations that are using the $ENV{PROJECT}variable to have different "views" on a single Bugzilla.

The default directory includes templates shipped with Bugzilla.

The custom directory is a directory for local installations to override the default templates. Any individual template in custom will override a template of the same name and path in default.

$language is a language code, en being the default language shipped with Bugzilla. Localizers ship other languages.

$extension is the name of any directory in the extensions/ directory. Each extension has its own directory.

Note that languages are sorted by the user's preference (as specified in their browser, usually), and extensions are sorted alphabetically.

include_languages

Used by Bugzilla::Template to determine the languages' list which are compiled with the browser's Accept-Language and the languages of installed templates.

5.7.45.4. Methods in need of POD

supported_languages

extension_template_directory

extension_code_files

extension_web_directory

trick_taint

success

trim

extension_package_directory

set_output_encoding

extension_requirement_packages

prevent_windows_dialog_boxes

sortQvalue

no_checksetup_from_cgi


This documentation undoubtedly has bugs; if you find some, please file them here.