mirror of
https://github.com/moodle/moodle.git
synced 2025-08-10 03:16:42 +02:00
MDL-29046 use of install/distrolib.php in the CLI installer
Signed-off-by: Aleksey Avdeev <solo@altlinux.ru>
This commit is contained in:
parent
f36884dde7
commit
d43c4284e1
1 changed files with 18 additions and 5 deletions
|
@ -78,6 +78,16 @@ Example:
|
||||||
"; //TODO: localize, mark as needed in install - to be translated later when everything is finished
|
"; //TODO: localize, mark as needed in install - to be translated later when everything is finished
|
||||||
|
|
||||||
|
|
||||||
|
// distro specific customisation
|
||||||
|
$distrolibfile = dirname(dirname(dirname(__FILE__))).'/install/distrolib.php';
|
||||||
|
$distro = null;
|
||||||
|
if (file_exists($distrolibfile)) {
|
||||||
|
require_once($distrolibfile);
|
||||||
|
if (function_exists('distro_get_config')) {
|
||||||
|
$distro = distro_get_config();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Nothing to do if config.php exists
|
// Nothing to do if config.php exists
|
||||||
$configfile = dirname(dirname(dirname(__FILE__))).'/config.php';
|
$configfile = dirname(dirname(dirname(__FILE__))).'/config.php';
|
||||||
if (file_exists($configfile)) {
|
if (file_exists($configfile)) {
|
||||||
|
@ -180,14 +190,14 @@ if (empty($databases)) {
|
||||||
// now get cli options
|
// now get cli options
|
||||||
list($options, $unrecognized) = cli_get_params(
|
list($options, $unrecognized) = cli_get_params(
|
||||||
array(
|
array(
|
||||||
'chmod' => '2777',
|
'chmod' => isset($distro->directorypermissions) ? sprintf('%04o',$distro->directorypermissions) : '2777', // let distros set dir permissions
|
||||||
'lang' => $CFG->lang,
|
'lang' => $CFG->lang,
|
||||||
'wwwroot' => '',
|
'wwwroot' => '',
|
||||||
'dataroot' => str_replace('\\', '/', dirname(dirname(dirname(dirname(__FILE__)))).'/moodledata'),
|
'dataroot' => empty($distro->dataroot) ? str_replace('\\', '/', dirname(dirname(dirname(dirname(__FILE__)))).'/moodledata'): $distro->dataroot, // initialised later after including libs or by distro
|
||||||
'dbtype' => $defaultdb,
|
'dbtype' => empty($distro->dbtype) ? $defaultdb : $distro->dbtype, // let distro skip dbtype selection
|
||||||
'dbhost' => 'localhost',
|
'dbhost' => empty($distro->dbhost) ? 'localhost' : $distro->dbhost, // let distros set dbhost
|
||||||
'dbname' => 'moodle',
|
'dbname' => 'moodle',
|
||||||
'dbuser' => 'root',
|
'dbuser' => empty($distro->dbuser) ? 'root' : $distro->dbuser, // let distros set dbuser
|
||||||
'dbpass' => '',
|
'dbpass' => '',
|
||||||
'dbsocket' => false,
|
'dbsocket' => false,
|
||||||
'prefix' => 'mdl_',
|
'prefix' => 'mdl_',
|
||||||
|
@ -523,6 +533,9 @@ if ($interactive) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$CFG->dbpass = cli_input($prompt, $options['dbpass']);
|
$CFG->dbpass = cli_input($prompt, $options['dbpass']);
|
||||||
|
if (function_exists('distro_pre_create_db')) { // Hook for distros needing to do something before DB creation
|
||||||
|
$distro = distro_pre_create_db($database, $CFG->dbhost, $CFG->dbuser, $CFG->dbpass, $CFG->dbname, $CFG->prefix, array('dbpersist'=>0, 'dbsocket'=>$options['dbsocket']), $distro);
|
||||||
|
}
|
||||||
$hint_database = install_db_validate($database, $CFG->dbhost, $CFG->dbuser, $CFG->dbpass, $CFG->dbname, $CFG->prefix, array('dbpersist'=>0, 'dbsocket'=>$options['dbsocket']));
|
$hint_database = install_db_validate($database, $CFG->dbhost, $CFG->dbuser, $CFG->dbpass, $CFG->dbname, $CFG->prefix, array('dbpersist'=>0, 'dbsocket'=>$options['dbsocket']));
|
||||||
} while ($hint_database !== '');
|
} while ($hint_database !== '');
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue