From df2b9c9e28850c6c10be4d02090cee845d5a70a3 Mon Sep 17 00:00:00 2001 From: Corpsee Date: Mon, 26 May 2014 02:56:27 +0700 Subject: [PATCH 1/3] 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')) { From 9e73151755a7a0afd5a8d1ec01b260afe79ebc5d Mon Sep 17 00:00:00 2001 From: Corpsee Date: Mon, 26 May 2014 02:58:36 +0700 Subject: [PATCH 2/3] Fixed phpdoc --- PHPCI/Command/InstallCommand.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/PHPCI/Command/InstallCommand.php b/PHPCI/Command/InstallCommand.php index 8e79ea6c..f34c1af4 100644 --- a/PHPCI/Command/InstallCommand.php +++ b/PHPCI/Command/InstallCommand.php @@ -108,8 +108,10 @@ class InstallCommand extends Command /** * Check PHP version, required modules and for disabled functions. - * @param OutputInterface $output + * @param OutputInterface $output + * @throws \Exception */ + protected function checkRequirements(OutputInterface $output) { $output->write('Checking requirements...'); @@ -160,8 +162,8 @@ class InstallCommand extends Command /** * Try and connect to MySQL using the details provided. - * @param array $db - * @param OutputInterface $output + * @param array $db + * @param OutputInterface $output * @return bool */ protected function verifyDatabaseDetails(array $db, OutputInterface $output) @@ -210,6 +212,10 @@ class InstallCommand extends Command $output->writeln('OK'); } + /** + * @param OutputInterface $output + * @param DialogHelper $dialog + */ protected function createAdminUser(OutputInterface $output, DialogHelper $dialog) { // Try to create a user account: @@ -259,6 +265,9 @@ class InstallCommand extends Command } } + /** + * @param OutputInterface $output + */ protected function verifyNotInstalled(OutputInterface $output) { if (file_exists(PHPCI_DIR . 'PHPCI/config.yml')) { From 55d354d000c8a3a4db1a0af9d17184ab0e57bc52 Mon Sep 17 00:00:00 2001 From: Corpsee Date: Thu, 5 Jun 2014 22:00:49 +0700 Subject: [PATCH 3/3] Fixed trailing slash --- PHPCI/Command/InstallCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PHPCI/Command/InstallCommand.php b/PHPCI/Command/InstallCommand.php index f34c1af4..43495dc0 100644 --- a/PHPCI/Command/InstallCommand.php +++ b/PHPCI/Command/InstallCommand.php @@ -90,13 +90,13 @@ class InstallCommand extends Command $conf['b8']['database'] = $db; $conf['phpci']['url'] = $dialog->askAndValidate( $output, - 'Your PHPCI URL without trailing slash ("http://phpci.local" for example): ', + 'Your PHPCI URL ("http://phpci.local" for example): ', function ($answer) { if (!filter_var($answer, FILTER_VALIDATE_URL)) { throw new Exception('Must be a valid URL'); } - return $answer; + return rtrim($answer, '/'); }, false );