admin_externalpage_setup('toollangimport');
-if (!empty($CFG->skiplangupgrade)) {
- echo $OUTPUT->header();
- echo $OUTPUT->box(get_string('langimportdisabled', 'tool_langimport'));
- echo $OUTPUT->footer();
- die;
+if (empty($CFG->langotherroot)) {
+ throw new moodle_exception('missingcfglangotherroot', 'tool_langimport');
}
$mode = optional_param('mode', 0, PARAM_INT); // action
$pack = optional_param_array('pack', array(), PARAM_SAFEDIR); // pack to install
$uninstalllang = optional_param('uninstalllang', '', PARAM_LANG); // installed pack to uninstall
$confirm = optional_param('confirm', 0, PARAM_BOOL); // uninstallation confirmation
+$purgecaches = optional_param('purgecaches', false, PARAM_BOOL); // explicit caches reset
+
+if ($purgecaches) {
+ require_sesskey();
+ get_string_manager()->reset_caches();
+ redirect($PAGE->url);
+}
+
+if (!empty($CFG->skiplangupgrade)) {
+ echo $OUTPUT->header();
+ echo $OUTPUT->box(get_string('langimportdisabled', 'tool_langimport'));
+ echo $OUTPUT->single_button(new moodle_url($PAGE->url, array('purgecaches' => 1)), get_string('purgestringcaches', 'tool_langimport'));
+ echo $OUTPUT->footer();
+ die;
+}
define('INSTALLATION_OF_SELECTED_LANG', 2);
define('DELETION_OF_SELECTED_LANG', 4);
$string['install'] = 'Install selected language pack';
$string['installedlangs'] = 'Installed language packs';
$string['langimport'] = 'Language import utility';
-$string['langimportdisabled'] = 'Language import feature has been disabled. You have to update your language packs manually at the file-system level.';
+$string['langimportdisabled'] = 'Language import feature has been disabled. You have to update your language packs manually at the file-system level. Do not forget to purge string caches after you do so.';
$string['langpackinstalled'] = 'Language pack {$a} was successfully installed';
$string['langpackremoved'] = 'Language pack was uninstalled';
$string['langpackupdateskipped'] = 'Update of {$a} language pack skipped';
$string['langpackuptodate'] = 'Language pack {$a} is up-to-date';
$string['langupdatecomplete'] = 'Language pack update completed';
+$string['missingcfglangotherroot'] = 'Missing configuration value $CFG->langotherroot';
$string['missinglangparent'] = 'Missing parent language <em>{$a->parent}</em> of <em>{$a->lang}</em>.';
$string['nolangupdateneeded'] = 'All your language packs are up to date, no update is needed';
$string['pluginname'] = 'Language packs';
+$string['purgestringcaches'] = 'Purge string caches';
$string['remotelangnotavailable'] = 'Because Moodle can not connect to download.moodle.org, we are unable to do language pack installation automatically. Please download the appropriate zip file(s) from http://download.moodle.org, copy them to your {$a} directory and unzip them manually.';
$string['uninstall'] = 'Uninstall selected language pack';
$string['uninstallconfirm'] = 'You are about to completely uninstall language pack {$a}, are you sure?';