mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 13:38:32 +01:00
MDL-72984 cli: add support email option to cli install
This commit is contained in:
parent
4c5db7e80f
commit
f88bcdb041
@ -75,6 +75,7 @@ Options:
|
||||
required in non-interactive mode.
|
||||
--adminemail=STRING Email address for the moodle admin account.
|
||||
--sitepreset=STRING Admin site preset to be applied during the installation process.
|
||||
--supportemail=STRING Email address for support and help.
|
||||
--upgradekey=STRING The upgrade key to be set in the config.php, leave empty to not set it.
|
||||
--non-interactive No interactive questions, installation fails if any
|
||||
problem encountered.
|
||||
@ -256,6 +257,7 @@ list($options, $unrecognized) = cli_get_params(
|
||||
'adminpass' => '',
|
||||
'adminemail' => '',
|
||||
'sitepreset' => '',
|
||||
'supportemail' => '',
|
||||
'upgradekey' => '',
|
||||
'non-interactive' => false,
|
||||
'agree-license' => false,
|
||||
@ -739,6 +741,20 @@ if (!$skipdatabase) {
|
||||
$a = (object)['option' => 'adminemail', 'value' => $options['adminemail']];
|
||||
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
|
||||
}
|
||||
|
||||
// Ask for the support email address.
|
||||
if ($interactive) {
|
||||
cli_separator();
|
||||
cli_heading(get_string('clisupportemail', 'install'));
|
||||
$prompt = get_string('clitypevaluedefault', 'admin', $options['supportemail']);
|
||||
$options['supportemail'] = cli_input($prompt, $options['supportemail']);
|
||||
}
|
||||
|
||||
// Validate that the support email address provided is valid.
|
||||
if (!empty($options['supportemail']) && !validate_email($options['supportemail'])) {
|
||||
$a = (object)['option' => 'supportemail', 'value' => $options['supportemail']];
|
||||
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
|
||||
}
|
||||
}
|
||||
|
||||
// Ask for the upgrade key.
|
||||
|
@ -48,6 +48,7 @@ $string['cliinstallfinished'] = 'Installation completed successfully.';
|
||||
$string['cliinstallheader'] = 'Moodle {$a} command line installation program';
|
||||
$string['climustagreelicense'] = 'In non-interactive mode you must agree to the licence by specifying --agree-license option';
|
||||
$string['cliskipdatabase'] = 'Skipping database installation.';
|
||||
$string['clisupportemail'] = 'Support email address';
|
||||
$string['clitablesexist'] = 'Database tables already present; CLI installation cannot continue.';
|
||||
$string['compatibilitysettings'] = 'Checking your PHP settings ...';
|
||||
$string['compatibilitysettingshead'] = 'Checking your PHP settings ...';
|
||||
|
@ -506,6 +506,11 @@ function install_cli_database(array $options, $interactive) {
|
||||
$DB->set_field('user', 'username', $options['adminuser'], array('username' => 'admin'));
|
||||
}
|
||||
|
||||
// Set the support email address if specified.
|
||||
if (isset($options['supportemail'])) {
|
||||
set_config('supportemail', $options['supportemail']);
|
||||
}
|
||||
|
||||
// indicate that this site is fully configured
|
||||
set_config('rolesactive', 1);
|
||||
upgrade_finished();
|
||||
|
Loading…
x
Reference in New Issue
Block a user