From: stronk7 Date: Fri, 10 Mar 2006 01:07:41 +0000 (+0000) Subject: Now the installer will try to download the selected lang pack X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=68a3f81d4d044f6d7c510a7365fb5226fac4f89d;p=moodle.git Now the installer will try to download the selected lang pack from download.moodle.org to be able to continue with the installation using such lang. --- diff --git a/install.php b/install.php index e0e36ef842..96ffb29579 100644 --- a/install.php +++ b/install.php @@ -18,8 +18,9 @@ define ('DIRECTORY', 2); /// 2. Directory settings define ('DATABASE', 3); /// 2. Database settings define ('ADMIN', 4); /// 4. Administration directory name define ('ENVIRONMENT', 5); /// 5. Administration directory name -define ('SAVE', 6); /// 6. Save or display the settings -define ('REDIRECT', 7); /// 7. Redirect to index.php +define ('DOWNLOADLANG', 6); /// 6. Load complete lang from download.moodle.org +define ('SAVE', 7); /// 7. Save or display the settings +define ('REDIRECT', 8); /// 8. Redirect to index.php ///==========================================================================// @@ -115,6 +116,7 @@ require_once('./lib/weblib.php'); require_once('./lib/adodb/adodb.inc.php'); require_once('./lib/environmentlib.php'); require_once('./lib/xmlize.php'); +require_once('./lib/componentlib.class.php'); require_once('./version.php'); /// Set version and release @@ -135,6 +137,7 @@ $headstagetext = array(WELCOME => get_string('chooselanguagehead', 'instal DATABASE => get_string('databasesettingshead', 'install'), ADMIN => get_string('admindirsettinghead', 'install'), ENVIRONMENT => get_string('environmenthead', 'install'), + DOWNLOADLANG => get_string('downloadlanguagehead', 'install'), SAVE => get_string('configurationcompletehead', 'install') ); @@ -144,6 +147,7 @@ $substagetext = array(WELCOME => get_string('chooselanguagesub', 'install' DATABASE => get_string('databasesettingssub', 'install'), ADMIN => get_string('admindirsettingsub', 'install'), ENVIRONMENT => get_string('environmentsub', 'install'), + DOWNLOADLANG => get_string('downloadlanguagesub', 'install'), SAVE => get_string('configurationcompletesub', 'install') ); @@ -361,7 +365,6 @@ if ($INSTALL['stage'] == ENVIRONMENT) { } } - //==========================================================================// /// Display or print the data @@ -707,7 +710,62 @@ function form_table($nextstage = WELCOME, $formaction = "install.php") { + + + + + install(); //returns ERROR | UPTODATE | INSTALLED + switch ($status) { + case ERROR: + if ($cd->get_error() == 'remotedownloadnotallowed') { + $a = new stdClass(); + $a->url = 'http://download.moodle.org/lang16/'.$pack.'zip'; + $a->dest= $CFG->dataroot.'/lang'; + $errormsg = get_string($cd->get_error(), 'error', $a); + } else { + $errormsg = get_string($cd->get_error(), 'error'); + } + break; + case UPTODATE: + case INSTALLED: + $downloadsuccess = true; + break; + default: + //We shouldn't reach this point + } + } else { + //We shouldn't reach this point + } + + if (!empty($errormsg)) echo "

$errormsg

\n"; + + error_reporting(7); // Show errors + if ($downloadsuccess) { + print_simple_box(get_string('langdownloadok', 'install', $INSTALL['language']), 'center'); + } else { + print_simple_box(get_string('langdownloaderror', 'install', $INSTALL['language']), 'center'); + } + ?> + +