mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-22294 CLI installer now supports --dataroot argument correctly
This commit is contained in:
parent
7d73574c6f
commit
59ba2bb002
3 changed files with 13 additions and 10 deletions
|
@ -47,8 +47,8 @@ Options:
|
||||||
--wwwroot=URL Web address for the Moodle site,
|
--wwwroot=URL Web address for the Moodle site,
|
||||||
required in non-interactive mode.
|
required in non-interactive mode.
|
||||||
--dataroot=DIR Location of the moodle data folder,
|
--dataroot=DIR Location of the moodle data folder,
|
||||||
must not be web accessible. Default is moodleroot
|
must not be web accessible. Default is moodledata
|
||||||
in parent directory.
|
in the parent directory.
|
||||||
--dbtype=TYPE Database type. Default is mysqli
|
--dbtype=TYPE Database type. Default is mysqli
|
||||||
--dbhost=HOST Database host. Default is localhost
|
--dbhost=HOST Database host. Default is localhost
|
||||||
--dbname=NAME Database name. Default is moodle
|
--dbname=NAME Database name. Default is moodle
|
||||||
|
@ -110,8 +110,10 @@ $CFG->dirroot = str_replace('\\', '/', dirname(dirname(dirname(__FI
|
||||||
$CFG->libdir = "$CFG->dirroot/lib";
|
$CFG->libdir = "$CFG->dirroot/lib";
|
||||||
$CFG->wwwroot = "http://localhost";
|
$CFG->wwwroot = "http://localhost";
|
||||||
$CFG->httpswwwroot = $CFG->wwwroot;
|
$CFG->httpswwwroot = $CFG->wwwroot;
|
||||||
$CFG->dataroot = str_replace('\\', '/', dirname(dirname(dirname(__FILE__))).'/moodledata');
|
$CFG->dataroot = str_replace('\\', '/', dirname(dirname(dirname(dirname(__FILE__)))).'/moodledata');
|
||||||
$CFG->docroot = 'http://docs.moodle.org';
|
$CFG->docroot = 'http://docs.moodle.org';
|
||||||
|
$CFG->langotherroot = $CFG->dataroot.'/lang';
|
||||||
|
$CFG->langlocalroot = $CFG->dataroot.'/lang';
|
||||||
$CFG->directorypermissions = 00777;
|
$CFG->directorypermissions = 00777;
|
||||||
$CFG->running_installer = true;
|
$CFG->running_installer = true;
|
||||||
$CFG->early_install_lang = true;
|
$CFG->early_install_lang = true;
|
||||||
|
@ -293,20 +295,21 @@ if ($interactive) {
|
||||||
if (make_upload_directory('lang', false)) {
|
if (make_upload_directory('lang', false)) {
|
||||||
$error = '';
|
$error = '';
|
||||||
} else {
|
} else {
|
||||||
$error = get_string('pathserrcreatedataroot', 'install', $CFG->dataroot)."\n";
|
$a = (object)array('dataroot' => $CFG->dataroot);
|
||||||
|
$error = get_string('pathserrcreatedataroot', 'install', $a)."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} while ($error !== '');
|
} while ($error !== '');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
$CFG->dataroot = $options['dataroot'];
|
||||||
if (is_dataroot_insecure()) {
|
if (is_dataroot_insecure()) {
|
||||||
$a = (object)array('option'=>'dataroot', 'value'=>$CFG->dataroot);
|
cli_error(get_string('pathsunsecuredataroot', 'install'));
|
||||||
//TODO: use unsecure warning instead
|
|
||||||
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
|
|
||||||
}
|
}
|
||||||
if (!make_upload_directory('lang', false)) {
|
if (!make_upload_directory('lang', false)) {
|
||||||
cli_error(get_string('pathserrcreatedataroot', 'install', $CFG->dataroot));
|
$a = (object)array('dataroot' => $CFG->dataroot);
|
||||||
|
cli_error(get_string('pathserrcreatedataroot', 'install', $a));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ function install_db_validate($database, $dbhost, $dbuser, $dbpass, $dbname, $pre
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function install_generate_configphp($database, $cfg, $userealpath=false) {
|
function install_generate_configphp($database, $cfg, $userealpath=false) {
|
||||||
$configphp = '<?php // Moodle Configuration File ' . PHP_EOL . PHP_EOL;
|
$configphp = '<?php // Moodle configuration file' . PHP_EOL . PHP_EOL;
|
||||||
|
|
||||||
$configphp .= 'unset($CFG);' . PHP_EOL;
|
$configphp .= 'unset($CFG);' . PHP_EOL;
|
||||||
$configphp .= '$CFG = new stdClass();' . PHP_EOL . PHP_EOL; // prevent PHP5 strict warnings
|
$configphp .= '$CFG = new stdClass();' . PHP_EOL . PHP_EOL; // prevent PHP5 strict warnings
|
||||||
|
|
|
@ -785,7 +785,7 @@ function make_upload_directory($directory, $shownotices=true) {
|
||||||
umask(0000);
|
umask(0000);
|
||||||
|
|
||||||
if (!file_exists($currdir)) {
|
if (!file_exists($currdir)) {
|
||||||
if (!mkdir($currdir, $CFG->directorypermissions) or !is_writable($currdir)) {
|
if (!mkdir($currdir, $CFG->directorypermissions, true) or !is_writable($currdir)) {
|
||||||
if ($shownotices) {
|
if ($shownotices) {
|
||||||
echo '<div class="notifyproblem" align="center">ERROR: You need to create the directory '.
|
echo '<div class="notifyproblem" align="center">ERROR: You need to create the directory '.
|
||||||
$currdir .' with web server write access</div>'."<br />\n";
|
$currdir .' with web server write access</div>'."<br />\n";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue