mirror of
https://github.com/moodle/moodle.git
synced 2025-01-29 19:50:14 +01:00
MDL-75195 core: Added supportemail option to install_database.php
This commit is contained in:
parent
ef93325f27
commit
b914f01316
@ -57,6 +57,7 @@ Options:
|
||||
--fullname=STRING Name of the site
|
||||
--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.
|
||||
-h, --help Print out this help
|
||||
|
||||
Example:
|
||||
@ -98,6 +99,7 @@ list($options, $unrecognized) = cli_get_params(
|
||||
'fullname' => '',
|
||||
'shortname' => '',
|
||||
'summary' => '',
|
||||
'supportemail' => '',
|
||||
'agree-license' => false,
|
||||
'help' => false
|
||||
),
|
||||
@ -136,6 +138,15 @@ if (!empty($options['adminemail']) && !validate_email($options['adminemail'])) {
|
||||
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
|
||||
}
|
||||
|
||||
// Validate that the supportemail provided was an e-mail address.
|
||||
if (!empty($options['supportemail']) && !validate_email($options['supportemail'])) {
|
||||
$a = (object) [
|
||||
'option' => 'supportemail',
|
||||
'value' => $options['supportemail']
|
||||
];
|
||||
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';
|
||||
|
@ -507,8 +507,10 @@ function install_cli_database(array $options, $interactive) {
|
||||
}
|
||||
|
||||
// Set the support email address if specified.
|
||||
if (isset($options['supportemail'])) {
|
||||
if (!empty($options['supportemail'])) {
|
||||
set_config('supportemail', $options['supportemail']);
|
||||
} else if (!empty($options['adminemail'])) {
|
||||
set_config('supportemail', $options['adminemail']);
|
||||
}
|
||||
|
||||
// indicate that this site is fully configured
|
||||
|
Loading…
x
Reference in New Issue
Block a user