MDL-49008 lang: made lang update error reporting work

This commit is contained in:
Andrew Davis
2015-02-22 21:06:38 +01:00
parent 8235b610bb
commit 1ab376e86f
+4 -3
View File
@@ -156,7 +156,7 @@ class controller {
$updateablelangs = array();
foreach ($currentlangs as $clang) {
if (!array_key_exists($clang, $md5array)) {
$noticeok[] = get_string('langpackupdateskipped', 'tool_langimport', $clang);
$this->info[] = get_string('langpackupdateskipped', 'tool_langimport', $clang);
continue;
}
$dest1 = $CFG->dataroot.'/lang/'.$clang;
@@ -186,7 +186,7 @@ class controller {
$dest2 = $CFG->dirroot.'/lang/'.$pack;
if (file_exists($dest1)) {
if (!remove_dir($dest1)) {
$noticeerror[] = 'Could not delete old directory '.$dest1.', update of '.$pack
$this->errors[] = 'Could not delete old directory '.$dest1.', update of '.$pack
.' failed, please check permissions.';
unset($neededlangs[$packindex]);
continue;
@@ -194,7 +194,7 @@ class controller {
}
if (file_exists($dest2)) {
if (!remove_dir($dest2)) {
$noticeerror[] = 'Could not delete old directory '.$dest2.', update of '.$pack
$this->errors[] = 'Could not delete old directory '.$dest2.', update of '.$pack
.' failed, please check permissions.';
unset($neededlangs[$packindex]);
continue;
@@ -205,6 +205,7 @@ class controller {
try {
$updated = $this->install_languagepacks($neededlangs, true);
} catch (\moodle_exception $e) {
$this->errors[] = 'An exception occurred while installing language packs: ' . $e->getMessage();
return false;
}