Merged MDL-7351 from stable
This commit is contained in:
@@ -229,8 +229,11 @@
|
||||
}
|
||||
|
||||
if (empty($confirmupgrade)) {
|
||||
|
||||
|
||||
print_header($strdatabasechecking, $stradministration, $strdatabasechecking,
|
||||
"", "", false, " ", " ");
|
||||
|
||||
notice_yesno(get_string('upgradesure', 'admin', $a->newversion), 'index.php?confirmupgrade=yes', 'index.php');
|
||||
exit;
|
||||
|
||||
@@ -238,10 +241,15 @@
|
||||
$strdatabasesuccess = get_string("databasesuccess");
|
||||
print_header($strdatabasechecking, $stradministration, $strdatabasechecking,
|
||||
"", $linktoscrolltoerrors, false, " ", " ");
|
||||
|
||||
/// return to original debugging level
|
||||
$CFG->debug = $origdebug;
|
||||
error_reporting($CFG->debug);
|
||||
upgrade_log_start();
|
||||
|
||||
/// Upgrade current language pack if we can
|
||||
upgrade_language_pack();
|
||||
|
||||
print_heading($strdatabasechecking);
|
||||
$db->debug=true;
|
||||
/// Launch the old main upgrade (if exists)
|
||||
|
||||
@@ -2570,4 +2570,39 @@ function format_admin_setting($name, $title='', $form='', $description='') {
|
||||
"\n\n";
|
||||
}
|
||||
|
||||
/*
|
||||
* Try to upgrade the given language pack (or current language)
|
||||
* If it doesn't work, fail silently and return false
|
||||
*/
|
||||
function upgrade_language_pack($lang='') {
|
||||
global $CFG;
|
||||
|
||||
if (empty($lang)) {
|
||||
$lang = current_language();
|
||||
}
|
||||
|
||||
if ($lang == 'en_utf8') {
|
||||
return true; // Nothing to do
|
||||
}
|
||||
|
||||
notify(get_string('langimport', 'admin').': '.$lang.' ... ', 'notifysuccess');
|
||||
|
||||
@mkdir ($CFG->dataroot.'/temp/'); //make it in case it's a fresh install, it might not be there
|
||||
@mkdir ($CFG->dataroot.'/lang/');
|
||||
|
||||
require_once($CFG->libdir.'/componentlib.class.php');
|
||||
|
||||
if ($cd = new component_installer('http://download.moodle.org', 'lang16', $lang.'.zip', 'languages.md5', 'lang')) {
|
||||
$status = $cd->install(); //returns ERROR | UPTODATE | INSTALLED
|
||||
|
||||
if ($status == INSTALLED) {
|
||||
debugging('Downloading successful: '.$lang);
|
||||
@unlink($CFG->dataroot.'/cache/languages');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user