mirror of
https://github.com/friendica/friendica
synced 2024-11-09 23:02:54 +00:00
Merge pull request #4967 from nupplaphil/4899-autoinstall-with-file
AutomaticInstallation - use config file
This commit is contained in:
commit
538143f628
2 changed files with 12 additions and 7 deletions
|
@ -23,10 +23,10 @@ $db_data = 'mysqldatabasename';
|
|||
|
||||
// Use environment variables for mysql if they are set beforehand
|
||||
if (!empty(getenv('MYSQL_HOST'))
|
||||
&& !empty(getenv('MYSQL_PORT'))
|
||||
&& !empty(getenv('MYSQL_USERNAME'))
|
||||
&& !empty(getenv('MYSQL_PASSWORD'))
|
||||
&& !empty(getenv('MYSQL_DATABASE'))) {
|
||||
&& !empty(getenv('MYSQL_PORT'))
|
||||
&& !empty(getenv('MYSQL_USERNAME'))
|
||||
&& !empty(getenv('MYSQL_PASSWORD'))
|
||||
&& !empty(getenv('MYSQL_DATABASE'))) {
|
||||
$db_host = getenv('MYSQL_HOST') . ':' . getenv('MYSQL_PORT');
|
||||
$db_user = getenv('MYSQL_USERNAME');
|
||||
$db_pass = getenv('MYSQL_PASSWORD');
|
||||
|
|
|
@ -29,6 +29,7 @@ Options
|
|||
-h|--help|-? Show help information
|
||||
-v Show more debug information.
|
||||
-a All setup checks are required (except .htaccess)
|
||||
-f prepared config file (e.g. ".htconfig.php" itself)
|
||||
HELP;
|
||||
}
|
||||
|
||||
|
@ -42,7 +43,11 @@ HELP;
|
|||
$db_user = '';
|
||||
$db_pass = '';
|
||||
$db_data = '';
|
||||
require_once 'htconfig.php';
|
||||
|
||||
$config_file = $this->getOption('f', 'htconfig.php');
|
||||
|
||||
$this->out("Using config $config_file...\n");
|
||||
require_once $config_file;
|
||||
|
||||
Install::setInstallMode();
|
||||
|
||||
|
@ -87,8 +92,8 @@ HELP;
|
|||
|
||||
// Copy config file
|
||||
$this->out("Saving config file...\n");
|
||||
if (!copy('htconfig.php', '.htconfig.php')) {
|
||||
throw new \RuntimeException("ERROR: Saving config file failed. Please copy .htautoinstall.php to .htconfig.php manually.\n");
|
||||
if ($config_file != '.htconfig.php' && !copy($config_file, '.htconfig.php')) {
|
||||
throw new \RuntimeException("ERROR: Saving config file failed. Please copy '$config_file' to '.htconfig.php' manually.\n");
|
||||
}
|
||||
$this->out(" Complete!\n\n");
|
||||
$this->out("\nInstallation is finished\n");
|
||||
|
|
Loading…
Reference in a new issue