Moodle  2.2.1
http://www.collinsharper.com
lang_installer Class Reference

End of component_installer class. More...

Inheritance diagram for lang_installer:

Public Member Functions

 __construct ($langcode= '')
 set_queue ($langcodes)
 run ()
 lang_pack_url ($langcode= '')
 get_remote_list_of_languages ()

Data Fields

const RESULT_INSTALLED = 'installed'
const RESULT_UPTODATE = 'uptodate'
const RESULT_DOWNLOADERROR = 'downloaderror'

Protected Member Functions

 add_to_queue ($langcodes)
 is_queued ($langcode= '')
 was_processed ($langcode)
 mark_processed ($langcode)
 get_parent_language ($langcode)
 install_language_pack ($langcode)

Protected Attributes

 $queue = array()
 $current
 $done = array()
 $version

Detailed Description

End of component_installer class.

Language packs installer

This class wraps the functionality provided by component_installer and adds support for installing a set of language packs.

Given an array of required language packs, this class fetches them all and installs them. It detects eventual dependencies and installs all parent languages, too.

Definition at line 567 of file componentlib.class.php.


Constructor & Destructor Documentation

__construct ( langcode = '')

Prepare the installer

Todo:
Moodle major version is hardcoded here, should be obtained from version.php or so
Parameters:
string | array$langcodea code of the language to install

Definition at line 591 of file componentlib.class.php.

Here is the call graph for this function:


Member Function Documentation

add_to_queue ( langcodes) [protected]

Adds a language pack (or a list of them) to the queue

Parameters:
string | array$langcodescode of the language to install or a list of them

Definition at line 705 of file componentlib.class.php.

Here is the caller graph for this function:

get_parent_language ( langcode) [protected]

Returns a parent language of the given installed language

Parameters:
string$langcode
Returns:
string parent language's code

Reimplemented in testable_lang_installer.

Definition at line 759 of file componentlib.class.php.

Here is the caller graph for this function:

Returns the list of available language packs from download.moodle.org

Returns:
array|bool false if can not download

Definition at line 680 of file componentlib.class.php.

Here is the call graph for this function:

install_language_pack ( langcode) [protected]

Perform the actual language pack installation

component_installer

Parameters:
string$langcode
Returns:
int return status

Reimplemented in testable_lang_installer.

Definition at line 770 of file componentlib.class.php.

Here is the caller graph for this function:

is_queued ( langcode = '') [protected]

Definition at line 722 of file componentlib.class.php.

Here is the caller graph for this function:

lang_pack_url ( langcode = '')

Returns the URL where a given language pack can be downloaded

Alternatively, if the parameter is empty, returns URL of the page with the list of all available language packs.

Parameters:
string$langcodelanguage code like 'cs' or empty for unknown
Returns:
string URL

Definition at line 666 of file componentlib.class.php.

mark_processed ( langcode) [protected]

Mark the given language pack as processed

See also:
self::was_processed()
Parameters:
string$langcode

Definition at line 749 of file componentlib.class.php.

Here is the caller graph for this function:

run ( )

Runs the installer

This method calls self::install_language_pack for every language in the queue. If a dependency is detected, the parent language is added to the queue.

Returns:
array results, array of self::RESULT_xxx constants indexed by language code

Definition at line 625 of file componentlib.class.php.

Here is the call graph for this function:

set_queue ( langcodes)

Sets the queue of language packs to be installed

Parameters:
string | array$langcodeslanguage code like 'cs' or a list of them

Definition at line 609 of file componentlib.class.php.

Here is the caller graph for this function:

was_processed ( langcode) [protected]

Checks if the given language has already been processed by this instance

See also:
self::mark_processed()
Parameters:
string$langcode
Returns:
boolean

Definition at line 739 of file componentlib.class.php.

Here is the caller graph for this function:


Field Documentation

$current [protected]

Definition at line 579 of file componentlib.class.php.

$done = array() [protected]

Definition at line 581 of file componentlib.class.php.

$queue = array() [protected]

Definition at line 577 of file componentlib.class.php.

$version [protected]

Definition at line 583 of file componentlib.class.php.

const RESULT_DOWNLOADERROR = 'downloaderror'

there was a problem with downloading the lang pack

Definition at line 574 of file componentlib.class.php.

const RESULT_INSTALLED = 'installed'

lang pack was successfully downloaded and deployed

Definition at line 570 of file componentlib.class.php.

const RESULT_UPTODATE = 'uptodate'

lang pack was up-to-date so no download was needed

Definition at line 572 of file componentlib.class.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations