MDL-85576 cli: add noreply email option to cli install.

This commit is contained in:
Luca Bösch
2025-11-27 13:48:21 +01:00
parent 52c6473e16
commit 2195a490b3
4 changed files with 30 additions and 0 deletions
+8
View File
@@ -58,6 +58,7 @@ Options:
--shortname=STRING Name of the site
--summary=STRING The summary to be displayed on the front page
--supportemail=STRING Email address for support and help.
--noreplyemail=STRING Email address used for noreply.
-h, --help Print out this help
Example:
@@ -100,6 +101,7 @@ list($options, $unrecognized) = cli_get_params(
'shortname' => '',
'summary' => '',
'supportemail' => '',
'noreplyemail' => '',
'agree-license' => false,
'help' => false
),
@@ -147,6 +149,12 @@ if (!empty($options['supportemail']) && !validate_email($options['supportemail']
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
}
// Validate that the noreply address provided is valid.
if (!empty($options['noreplyemail']) && !validate_email($options['noreplyemail'])) {
$a = (object)['option' => 'noreplyemail', 'value' => $options['noreplyemail']];
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
}
$options['lang'] = clean_param($options['lang'], PARAM_SAFEDIR);
if (!file_exists($CFG->dirroot.'/install/lang/'.$options['lang'])) {
$options['lang'] = 'en';