MDL-15249 towards localized cli installer

This commit is contained in:
skodak 2009-05-30 19:02:04 +00:00
parent 11e167a9d0
commit b8523467c7
3 changed files with 17 additions and 13 deletions

View File

@ -114,7 +114,7 @@ $CFG->httpsthemewww = $CFG->wwwroot;
$CFG->dataroot = str_replace('\\', '/', dirname(dirname(dirname(__FILE__))).'/moodledata');
$CFG->docroot = 'http://docs.moodle.org';
$CFG->directorypermissions = 00777;
//$CFG->running_installer = true;
//$CFG->running_installer = true; //TODO: uncomment when install lang packs are regenerated
$parts = explode('/', str_replace('\\', '/', dirname(dirname(__FILE__))));
$CFG->admin = array_pop($parts);
@ -336,8 +336,6 @@ if ($CFG->lang != 'en_utf8') {
}
}
}
unset($CFG->running_installer); // we use full lang packs from now on
// ask for db type - show only drivers available
if ($interactive) {
@ -467,11 +465,15 @@ if ($interactive) {
cli_separator();
if (!$options['agree-license']) {
echo "Do you agree to Moodle license blah blah blah?\n"; //TODO: localize and use real license
$input = cli_input('Type yes or y if you agree, ctrl+c if not', '', array('yes', 'y')); // TODO: localize including yes/y
$prompt = get_string('cliyesnoprompt', 'admin');
$input = cli_input($prompt, '', array('n', 'y'));
if ($input == get_string('clianswerno', 'admin')) {
exit(1);
}
}
} else {
if (!$options['agree-license']) {
cli_error('You must aggree to license by specifying --agree-license'); //TODO: localize
cli_error(get_string('climustagreelicense', 'install'));
}
}
@ -485,9 +487,6 @@ if (($fh = fopen($configfile, 'w')) !== false) {
if (!file_exists($configfile)) {
cli_error('Can not create config file.');
} else if ($interactive) {
cli_separator();
echo "config.php created\n";
}
// return back to original dir before executing setup.php chich changes the dir again
@ -508,7 +507,7 @@ $CFG->release = "";
require($CFG->dirroot.'/version.php');
if ($DB->get_tables() ) {
cli_error('Database tables already present, cli installation can not continue.');
cli_error(get_string('clitablesexist', 'install'));
}
if (!$DB->setup_is_unicodedb()) {
@ -520,7 +519,7 @@ if (!$DB->setup_is_unicodedb()) {
if ($interactive) {
cli_separator();
echo get_string('databasesetup')."\n";
cli_heading(get_string('databasesetup'));
}
// install core
@ -548,6 +547,5 @@ admin_apply_default_settings(NULL, true);
admin_apply_default_settings(NULL, true);
set_config('registerauth', '');
echo "yay!!!\n";
exit(0); // 0 means success
echo get_string('cliinstallfinished', 'install')."\n";
exit(0); // 0 means success

View File

@ -59,9 +59,12 @@ $string['choosefiletoedit'] = 'Choose file to edit';
$string['clamfailureonupload'] = 'On clam AV failure';
$string['cleanup'] = 'Cleanup';
$string['cliincorrectvalueerror'] = 'Error, incorrect value \"$a->value\" for \"$a->option\"';
$string['clianswerno'] = 'n';
$string['cliansweryes'] = 'y';
$string['cliincorrectvalueretry'] = 'Incorrect value, please retry';
$string['clitypevalue'] = 'type value';
$string['clitypevaluedefault'] = 'type value, press Enter to use default value ($a)';
$string['cliyesnoprompt'] = 'type y (means yes) or n (means no)';
$string['cliunknowoption'] = "Unrecognized options:\n \$a\n. Please use --help option.";
$string['commonfiltersettings'] = 'Common filter settings';
$string['commonsettings'] = 'Common settings';

View File

@ -23,7 +23,10 @@ $string['chooselanguagehead'] = 'Choose a language';
$string['chooselanguagesub'] = 'Please choose a language for the installation. This language will also be used as the default language for the site, though it may be changed later.';
$string['cliadminpassword'] = 'New admin user password';
$string['clialreadyinstalled'] = 'File config.php already exists, please use admin/cli/upgrade.php if you want to upgrade your site.';
$string['cliinstallfinished'] = 'Installation completed successfully.';
$string['cliinstallheader'] = 'Moodle $a command line installation program';
$string['climustagreelicense'] = 'In non interactive mode you must aggree to license by specifying --agree-license option';
$string['clitablesexist'] = 'Database tables already present, cli installation can not continue.';
$string['compatibilitysettings'] = 'Checking your PHP settings ...';
$string['compatibilitysettingshead'] = 'Checking your PHP settings ...';
$string['compatibilitysettingssub'] = 'Your server should pass all these tests to make Moodle run properly';