Skip to content

Commit

Permalink
Get db-url in execute when interactive mode is disabled (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
hjuarez20 authored and enzolutions committed Jul 24, 2018
1 parent 6f0f3a2 commit ce0a1e0
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/Command/Site/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,9 @@ protected function interact(InputInterface $input, OutputInterface $output)
// --db-url option
$db_url = $input->getOption('db-url');
$valuesFromUrl = parse_url($db_url);
var_dump($valuesFromUrl);

// --db-host option
$dbHost = $db_url?$valuesFromUrl['host']:$input->getOption('db-host');
var_dump($dbHost);
if (!$dbHost) {
$dbHost = $this->dbHostQuestion();
}
Expand Down Expand Up @@ -305,6 +303,16 @@ protected function execute(InputInterface $input, OutputInterface $output)
$dbPrefix = $input->getOption('db-prefix');
$force = $input->getOption('force');

//Check if there is a url to db connection
$db_url = $input->getOption('db-url');
if ($db_url) {
$valuesFromUrl = parse_url($db_url);
$dbHost = $valuesFromUrl['host'];
$dbName = ltrim($valuesFromUrl['path'], "/");
$dbUser = $valuesFromUrl['user'];
$dbPass = $valuesFromUrl['pass'];
}

$configParameters = array(
'dbhost' => $dbHost,
'dbname' => $dbName,
Expand All @@ -326,6 +334,8 @@ protected function execute(InputInterface $input, OutputInterface $output)

);



$this->generator->generate(
$this->appRoot,
$force,
Expand Down

0 comments on commit ce0a1e0

Please sign in to comment.