From 820d3831b8b84013d2a8b91f53ea271e1ee656c1 Mon Sep 17 00:00:00 2001 From: Dan Cryer Date: Wed, 25 Feb 2015 14:18:05 +0000 Subject: [PATCH] Updating Settings Controller to use the configured config file, rather than assuming config.yml --- PHPCI/Controller/SettingsController.php | 7 ++++--- bootstrap.php | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/PHPCI/Controller/SettingsController.php b/PHPCI/Controller/SettingsController.php index 3c5ab5f4..a13c9fd4 100644 --- a/PHPCI/Controller/SettingsController.php +++ b/PHPCI/Controller/SettingsController.php @@ -40,7 +40,7 @@ class SettingsController extends Controller parent::init(); $parser = new Parser(); - $yaml = file_get_contents(APPLICATION_PATH . 'PHPCI/config.yml'); + $yaml = file_get_contents(PHPCI_CONFIG_FILE); $this->settings = $parser->parse($yaml); } @@ -76,6 +76,7 @@ class SettingsController extends Controller $authSettings = $this->settings['phpci']['authentication_settings']; } + $this->view->configFile = PHPCI_CONFIG_FILE; $this->view->basicSettings = $this->getBasicForm($basicSettings); $this->view->buildSettings = $this->getBuildForm($buildSettings); $this->view->github = $this->getGithubForm(); @@ -241,7 +242,7 @@ class SettingsController extends Controller { $dumper = new Dumper(); $yaml = $dumper->dump($this->settings, 4); - file_put_contents(APPLICATION_PATH . 'PHPCI/config.yml', $yaml); + file_put_contents(PHPCI_CONFIG_FILE, $yaml); if (error_get_last()) { $error_get_last = error_get_last(); @@ -386,7 +387,7 @@ class SettingsController extends Controller */ protected function canWriteConfig() { - return is_writeable(APPLICATION_PATH . 'PHPCI/config.yml'); + return is_writeable(PHPCI_CONFIG_FILE); } /** diff --git a/bootstrap.php b/bootstrap.php index b15a7e59..252697a8 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -25,6 +25,8 @@ if (!empty($configEnv)) { $configFile = $configEnv; } +define('PHPCI_CONFIG_FILE', $configFile); + // If we don't have a config file at all, fail at this point and tell the user to install: if (!file_exists($configFile) && (!defined('PHPCI_IS_CONSOLE') || !PHPCI_IS_CONSOLE)) { $message = 'PHPCI has not yet been installed - Please use the command "./console phpci:install" ';