]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-15249 towards localized cli installer
authorskodak <skodak>
Sat, 30 May 2009 19:02:04 +0000 (19:02 +0000)
committerskodak <skodak>
Sat, 30 May 2009 19:02:04 +0000 (19:02 +0000)
admin/cli/install.php
lang/en_utf8/admin.php
lang/en_utf8/install.php

index 9692c2a6b2a729a7ce3ce9b190d12a88ea054b8b..0410afa018a9c59edff93e8b29d0120566e68246 100644 (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
\ No newline at end of file
+echo get_string('cliinstallfinished', 'install')."\n";
+exit(0); // 0 means success
index 5e0965a432e5e18ecdad75c69c5d160e57b87520..e8d256caef09b836531c4ac1bcee6405a6f7e6b2 100644 (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';
index c86daca80a247159ad6544aacd8f77980d493ef5..a3607904235a1f12a1ba97d2f28bda2ac6d5204c 100644 (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';