AutomaticInstallation - use config file

- added new parameter "-f config file" to `AutomaticInstallation.php`
This commit is contained in:
Philipp Holzer 2018-05-01 13:11:25 +02:00
parent 493314a067
commit fa78f148c8

View file

@ -29,6 +29,7 @@ Options
-h|--help|-? Show help information -h|--help|-? Show help information
-v Show more debug information. -v Show more debug information.
-a All setup checks are required (except .htaccess) -a All setup checks are required (except .htaccess)
-f "htconfig.php" file
HELP; HELP;
} }
@ -42,7 +43,11 @@ HELP;
$db_user = ''; $db_user = '';
$db_pass = ''; $db_pass = '';
$db_data = ''; $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(); Install::setInstallMode();
@ -87,8 +92,8 @@ HELP;
// Copy config file // Copy config file
$this->out("Saving config file...\n"); $this->out("Saving config file...\n");
if (!copy('htconfig.php', '.htconfig.php')) { if ($config_file != '.htconfig.php' && !copy($config_file, '.htconfig.php')) {
throw new \RuntimeException("ERROR: Saving config file failed. Please copy .htautoinstall.php to .htconfig.php manually.\n"); throw new \RuntimeException("ERROR: Saving config file failed. Please copy htconfig.php to .htconfig.php manually.\n");
} }
$this->out(" Complete!\n\n"); $this->out(" Complete!\n\n");
$this->out("\nInstallation is finished\n"); $this->out("\nInstallation is finished\n");