From fa798ff1e4f0a17fb419ff34b2d27c4bfc4b5bc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ste=CC=81phane=20Goetz?= Date: Thu, 21 May 2015 18:04:57 +0200 Subject: [PATCH] Bugfixes --- libs/Daux.php | 24 ++++++++++++++++-------- libs/Format/Confluence/Generator.php | 2 ++ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/libs/Daux.php b/libs/Daux.php index 36ffd30..d2aeaa4 100644 --- a/libs/Daux.php +++ b/libs/Daux.php @@ -67,19 +67,27 @@ class Daux } } - private function loadConfigOverrides($config_file) + private function loadConfigOverrides($override_file) { + // Read main configuration $this->options = json_decode(file_get_contents($this->local_base . DS . 'default.json'), true); - $config_file = $this->local_base . DS . $config_file; - if (!file_exists($config_file)) { - throw new Exception('The local config file is missing. Check path : ' . $config_file); - } - - if (is_file($config_file)) { + // Read documentation overrides + $config_file = $this->docs_path . DS . 'config.json'; + if (file_exists($config_file)) { $config = json_decode(file_get_contents($config_file), true); if (!isset($config)) { - throw new Exception('There was an error parsing the Config file. Please review'); + throw new Exception('The local config file is missing. Check path : ' . $config_file); + } + $this->options = array_merge($this->options, $config); + } + + // Read command line overrides + $config_file = $this->local_base . DS . $override_file; + if (file_exists($config_file)) { + $config = json_decode(file_get_contents($config_file), true); + if (!isset($config)) { + throw new Exception('The local config file is missing. Check path : ' . $config_file); } $this->options = array_merge($this->options, $config); } diff --git a/libs/Format/Confluence/Generator.php b/libs/Format/Confluence/Generator.php index 0592fba..951146b 100644 --- a/libs/Format/Confluence/Generator.php +++ b/libs/Format/Confluence/Generator.php @@ -62,9 +62,11 @@ class Generator if (!array_key_exists('id', $published)) { if (array_key_exists('page', $entry)) { echo "Creating: " . $entry['file']->getUrl() . "\n"; + $published['version'] = 1; $published['id'] = $this->client->createPage($parent_id, $entry['title'], "The content will come very soon !"); } else { echo "Creating Placeholder page: " . $entry['title'] . "\n"; + $published['version'] = 1; $published['id'] = $this->client->createPage($parent_id, $entry['title'], ""); } }