Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
tool_langimport\controller Class Reference

Lang import controller. More...

Public Member Functions

 __construct ()
 Constructor.
 
 install_languagepacks ($langs, $updating=false)
 Install language packs provided.
 
 is_installed_lang ($lang, $md5check)
 checks the md5 of the zip file, grabbed from download.moodle.org, against the md5 of the local language file from last update
 
 lang_pack_url ($langcode='')
 Returns the URL where a given language pack can be downloaded.
 
 redirect (moodle_url $url)
 Redirect to the specified url, outputting any required messages.
 
 schedule_languagepacks_installation ($langs)
 Schedule installation of the given language packs asynchronously via ad hoc task.
 
 uninstall_language ($lang)
 Uninstall language pack.
 
 update_all_installed_languages ()
 Updated all install language packs with the latest found on servre.
 

Public Attributes

array $availablelangs
 languages available on the remote server
 
array $errors
 list of error messages
 
array $info
 list of informational messages
 

Detailed Description

Lang import controller.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ install_languagepacks()

tool_langimport\controller::install_languagepacks ( $langs,
$updating = false )

Install language packs provided.

Parameters
string | array$langsarray of langcodes or individual langcodes
bool$updatingtrue if updating the langpacks
Return values
intfalse if an error encountered or
Exceptions
moodle_exceptionwhen error is encountered installing langpack

◆ is_installed_lang()

tool_langimport\controller::is_installed_lang ( $lang,
$md5check )

checks the md5 of the zip file, grabbed from download.moodle.org, against the md5 of the local language file from last update

Parameters
string$langlanguage code
string$md5checkmd5 to check
Return values
booltrue if installed

◆ lang_pack_url()

tool_langimport\controller::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
Return values
stringURL

◆ redirect()

tool_langimport\controller::redirect ( moodle_url $url)

Redirect to the specified url, outputting any required messages.

Parameters
moodle_url$url

◆ schedule_languagepacks_installation()

tool_langimport\controller::schedule_languagepacks_installation ( $langs)

Schedule installation of the given language packs asynchronously via ad hoc task.

Parameters
string | array$langsarray of langcodes or individual langcodes

◆ uninstall_language()

tool_langimport\controller::uninstall_language ( $lang)

Uninstall language pack.

Parameters
string$langlanguage code
Return values
booltrue if language succesfull installed

◆ update_all_installed_languages()

tool_langimport\controller::update_all_installed_languages ( )

Updated all install language packs with the latest found on servre.

Return values
booltrue if languages succesfully updated.

The documentation for this class was generated from the following file: