From c4f8fd0c3df371edc63e7280b3802cc32a794160 Mon Sep 17 00:00:00 2001 From: David Mudrak Date: Thu, 27 May 2010 06:57:21 +0000 Subject: [PATCH] MDL-18797 The selected language pack fetched during install --- admin/cli/install.php | 6 +++--- install.php | 11 ++++++++--- lib/componentlib.class.php | 4 ++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/admin/cli/install.php b/admin/cli/install.php index b029378359..37e12e5eb1 100644 --- a/admin/cli/install.php +++ b/admin/cli/install.php @@ -363,11 +363,11 @@ //download lang pack with optional notification if ($CFG->lang != 'en') { - if ($cd = new component_installer('http://download.moodle.org', 'lang20', $CFG->lang.'.zip', 'languages.md5', 'lang')) { + if ($cd = new component_installer('http://download.moodle.org', 'langpack/2.0', $CFG->lang.'.zip', 'languages.md5', 'lang')) { if ($cd->install() == COMPONENT_ERROR) { if ($cd->get_error() == 'remotedownloaderror') { $a = new stdClass(); - $a->url = 'http://download.moodle.org/lang20/'.$CFG->lang.'.zip'; + $a->url = 'http://download.moodle.org/langpack/2.0/'.$CFG->lang.'.zip'; $a->dest = $CFG->dataroot.'/lang'; cli_problem(get_string($cd->get_error(), 'error', $a)); } else { @@ -376,7 +376,7 @@ } else { // install parent lang if defined if ($parentlang = get_parent_language()) { - if ($cd = new component_installer('http://download.moodle.org', 'lang20', $parentlang.'.zip', 'languages.md5', 'lang')) { + if ($cd = new component_installer('http://download.moodle.org', 'langpack/2.0', $parentlang.'.zip', 'languages.md5', 'lang')) { $cd->install(); } } diff --git a/install.php b/install.php index 18ba884f43..164d0539ea 100644 --- a/install.php +++ b/install.php @@ -347,11 +347,11 @@ $downloaderror = get_string('cannotcreatelangdir', 'error'); // Download and install lang component - } else if ($cd = new component_installer('http://download.moodle.org', 'lang20', $CFG->lang.'.zip', 'languages.md5', 'lang')) { + } else if ($cd = new component_installer('http://download.moodle.org', 'langpack/2.0', $CFG->lang.'.zip', 'languages.md5', 'lang')) { if ($cd->install() == COMPONENT_ERROR) { if ($cd->get_error() == 'remotedownloaderror') { $a = new stdClass(); - $a->url = 'http://download.moodle.org/lang20/'.$config->lang.'.zip'; + $a->url = 'http://download.moodle.org/langpack/2.0/'.$config->lang.'.zip'; $a->dest = $CFG->dataroot.'/lang'; $downloaderror = get_string($cd->get_error(), 'error', $a); } else { @@ -360,12 +360,17 @@ } else { // install parent lang if defined if ($parentlang = get_parent_language()) { - if ($cd = new component_installer('http://download.moodle.org', 'lang20', $parentlang.'.zip', 'languages.md5', 'lang')) { + if ($cd = new component_installer('http://download.moodle.org', 'langpack/2.0', $parentlang.'.zip', 'languages.md5', 'lang')) { $cd->install(); } } } } + // switch the string_manager instance to stop using install/lang/ + $CFG->early_install_lang = false; + $CFG->langotherroot = $CFG->dataroot.'/lang'; + $CFG->langlocalroot = $CFG->dataroot.'/lang'; + get_string_manager(true); if ($downloaderror !== '') { install_print_header($config, get_string('language'), get_string('langdownloaderror', 'install', $CFG->lang), $downloaderror); diff --git a/lib/componentlib.class.php b/lib/componentlib.class.php index 446ea938d1..96dd841f70 100644 --- a/lib/componentlib.class.php +++ b/lib/componentlib.class.php @@ -67,14 +67,14 @@ * To install one component: * * require_once($CFG->libdir.'/componentlib.class.php'); - * if ($cd = new component_installer('http://download.moodle.org', 'lang20', + * if ($cd = new component_installer('http://download.moodle.org', 'langpack/2.0', * 'es.zip', 'languages.md5', 'lang')) { * $status = $cd->install(); //returns COMPONENT_(ERROR | UPTODATE | INSTALLED) * switch ($status) { * case COMPONENT_ERROR: * if ($cd->get_error() == 'remotedownloaderror') { * $a = new stdClass(); - * $a->url = 'http://download.moodle.org/lang20/es.zip'; + * $a->url = 'http://download.moodle.org/langpack/2.0/es.zip'; * $a->dest= $CFG->dataroot.'/lang'; * print_error($cd->get_error(), 'error', '', $a); * } else {