From 6892bd3b6c6f19a13b9aae0bfdb208ba73ee3800 Mon Sep 17 00:00:00 2001 From: Dmitry Khomutov Date: Mon, 26 May 2014 02:56:27 +0700 Subject: [PATCH] Fixed PHPCI installation (Doesnt load the database settings when saving admin user) --- PHPCI/Command/InstallCommand.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/PHPCI/Command/InstallCommand.php b/PHPCI/Command/InstallCommand.php index 83c50437..8e79ea6c 100644 --- a/PHPCI/Command/InstallCommand.php +++ b/PHPCI/Command/InstallCommand.php @@ -12,6 +12,7 @@ namespace PHPCI\Command; use Exception; use PDO; +use b8\Config; use b8\Database; use b8\Store\Factory; use Symfony\Component\Console\Command\Command; @@ -89,7 +90,7 @@ class InstallCommand extends Command $conf['b8']['database'] = $db; $conf['phpci']['url'] = $dialog->askAndValidate( $output, - 'Your PHPCI URL (without trailing slash): ', + 'Your PHPCI URL without trailing slash ("http://phpci.local" for example): ', function ($answer) { if (!filter_var($answer, FILTER_VALIDATE_URL)) { throw new Exception('Must be a valid URL'); @@ -235,6 +236,8 @@ class InstallCommand extends Command $user->setIsAdmin(1); $user->setHash(password_hash($adminPass, PASSWORD_DEFAULT)); + $this->reloadConfig(); + $store = Factory::getStore('User'); $store->save($user); @@ -246,6 +249,16 @@ class InstallCommand extends Command } } + protected function reloadConfig() + { + $configFile = PHPCI_DIR . 'PHPCI/config.yml'; + $config = Config::getInstance(); + + if (file_exists($configFile)) { + $config->loadYaml($configFile); + } + } + protected function verifyNotInstalled(OutputInterface $output) { if (file_exists(PHPCI_DIR . 'PHPCI/config.yml')) {