Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 310 and 400] [Versions 311 and 400] [Versions 39 and 400]

Lang import controller

Copyright: 2014 Dan Poltawski <dan@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 282 lines (10 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: controller  - X-Ref

Lang import controller

__construct()   X-Ref
Constructor.


redirect(moodle_url $url)   X-Ref
Redirect to the specified url, outputting any required messages.

param: moodle_url $url

install_languagepacks($langs, $updating = false)   X-Ref
Install language packs provided

return: int false if an error encountered or
param: string|array $langs array of langcodes or individual langcodes
param: bool $updating true if updating the langpacks

uninstall_language($lang)   X-Ref
Uninstall language pack

return: bool true if language succesfull installed
param: string $lang language code

update_all_installed_languages()   X-Ref
Updated all install language packs with the latest found on servre

return: bool true if languages succesfully updated.

is_installed_lang($lang, $md5check)   X-Ref
checks the md5 of the zip file, grabbed from download.moodle.org,
against the md5 of the local language file from last update

return: bool true if installed
param: string $lang language code
param: string $md5check md5 to check

lang_pack_url($langcode = '')   X-Ref
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.

return: string URL
param: string $langcode language code like 'cs' or empty for unknown

schedule_languagepacks_installation($langs)   X-Ref
Schedule installation of the given language packs asynchronously via ad hoc task.

param: string|array $langs array of langcodes or individual langcodes