mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 00:16:46 +02:00
MDL-26804 core_string_manager::get_list_of_translations() can use a cache again
This patch reimplements the internal cache that was used to store the list of available translations in Moodle 1.x. By default, the method get_list_of_translations() still uses the file moodledata/cache/languages to store the list of available translations. The location of that file can be redefined in config.php. The internal format of the cache file is JSON now (used to be a plain text list). The patch also fixes a usage of the global $CFG in translation_exists() methods where the internal property should be used instead.
This commit is contained in:
parent
92a387b467
commit
a9cbd19bff
7 changed files with 67 additions and 17 deletions
|
@ -53,11 +53,6 @@ define('INSTALLATION_OF_SELECTED_LANG', 2);
|
|||
define('DELETION_OF_SELECTED_LANG', 4);
|
||||
define('UPDATE_ALL_LANG', 5);
|
||||
|
||||
//reset and diagnose lang cache permissions
|
||||
remove_dir($CFG->dataroot.'/cache/languages');
|
||||
if (file_exists($CFG->dataroot.'/cache/languages')) {
|
||||
print_error('cannotdeletelangcache', 'error');
|
||||
}
|
||||
get_string_manager()->reset_caches();
|
||||
|
||||
$notice_ok = array();
|
||||
|
|
|
@ -10,7 +10,7 @@ if ($hassiteconfig) {
|
|||
$temp->add(new admin_setting_configselect('lang', get_string('lang', 'admin'), get_string('configlang', 'admin'), current_language(), get_string_manager()->get_list_of_translations())); // $CFG->lang might be set in installer already, default en is in setup.php
|
||||
$temp->add(new admin_setting_configcheckbox('langmenu', get_string('langmenu', 'admin'), get_string('configlangmenu', 'admin'), 1));
|
||||
$temp->add(new admin_setting_langlist());
|
||||
$temp->add(new admin_setting_configcheckbox('langcache', get_string('langcache', 'admin'), get_string('configlangcache', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('langcache', get_string('langcache', 'admin'), get_string('langcache_desc', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('langstringcache', get_string('langstringcache', 'admin'), get_string('configlangstringcache', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configtext('locale', get_string('localetext', 'admin'), get_string('configlocale', 'admin'), '', PARAM_FILE));
|
||||
$temp->add(new admin_setting_configselect('latinexcelexport', get_string('latinexcelexport', 'admin'), get_string('configlatinexcelexport', 'admin'), '0', array('0'=>'Unicode','1'=>'Latin')));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue