From 6b997b07dd503b2cb42c89167fc3a87361f926e7 Mon Sep 17 00:00:00 2001 From: skodak Date: Sun, 31 May 2009 11:57:33 +0000 Subject: [PATCH] MDL-15249 localized cli upgrade --- admin/cli/upgrade.php | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/admin/cli/upgrade.php b/admin/cli/upgrade.php index 2b2d4ad69b..7d1baadb1d 100644 --- a/admin/cli/upgrade.php +++ b/admin/cli/upgrade.php @@ -48,8 +48,8 @@ list($options, $unrecognized) = cli_get_params(array('non-interactive'=>false, ' $interactive = empty($options['non-interactive']); if ($unrecognized) { - $error = implode("\n ", $unrecognized); - cli_error("Unrecognized options:\n $error \n. Please use --help option."); // TODO: localize + $unrecognized = implode("\n ", $unrecognized); + cli_error('cliunknowoption', 'admin', $unrecognized); } if ($options['help']) { @@ -65,14 +65,14 @@ Options: -h, --help Print out this help Example: \$sudo -u wwwrun /usr/bin/php admin/cli/upgrade.php -"; //TODO: localize +"; //TODO: localize, mark as needed in install - to be translated later when everything is finished echo $help; die; } if (empty($CFG->version)) { - cli_error('missingconfigversion', 'debug'); + cli_error(get_string('missingconfigversion', 'debug')); } require("$CFG->dirroot/version.php"); // defines $version and $release @@ -82,9 +82,15 @@ if ($version < $CFG->version) { cli_error('The code you are using is OLDER than the version that made these databases!'); // TODO: localize } +$newversion = "$release ($version)"; + if ($interactive) { - $prompt = "Do you really want to upgrade Moodle at '$CFG->wwwroot' from '$CFG->release' to '$release'?\nPress ctrl+c to cancel."; // TODO: localize - cli_input($prompt); + echo html_to_text(get_string('upgradesure', 'admin', $newversion))."\n"; + $prompt = get_string('cliyesnoprompt', 'admin'); + $input = cli_input($prompt, '', array(get_string('clianswerno', 'admin'), get_string('cliansweryes', 'admin'))); + if ($input == get_string('clianswerno', 'admin')) { + exit(1); + } } if ($version > $CFG->version) { @@ -104,6 +110,5 @@ session_set_user($admin); admin_apply_default_settings(NULL, true); admin_apply_default_settings(NULL, true); -echo "yay!\n"; - -exit(0); // 0 means success \ No newline at end of file +echo get_string('cliupgradefinished', 'admin')."\n"; +exit(0); // 0 means success -- 2.39.5