diff options
Diffstat (limited to 'utility')
-rw-r--r-- | utility/config.php | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/utility/config.php b/utility/config.php index e00ad940f..7841b3f5f 100644 --- a/utility/config.php +++ b/utility/config.php @@ -111,10 +111,10 @@ class Config { } else { $content = $this->fileSystem->file_get_contents($configPath); - $configValues = json_decode($content, true); + $configValues = parse_ini_string($content); - if($configValues === null) { - $this->api->log('Configuration contains invalid JSON' , 'warn'); + if($configValues === false || count($configValues) === 0) { + $this->api->log('Configuration invalid. Ignoring values.' , 'warn'); } else { foreach($configValues as $key => $value) { @@ -132,15 +132,15 @@ class Config { public function write($configPath) { - $json = json_encode(array( - "autoPurgeMinimumInterval" => $this->autoPurgeMinimumInterval, - "autoPurgeCount" => $this->autoPurgeCount, - "simplePieCacheDuration" => $this->simplePieCacheDuration, - "feedFetcherTimeout" => $this->feedFetcherTimeout, - "useCronUpdates" => $this->useCronUpdates, - ), JSON_PRETTY_PRINT); - - $this->fileSystem->file_put_contents($configPath, $json); + $ini = + "autoPurgeMinimumInterval = " . $this->autoPurgeMinimumInterval . "\n" . + "autoPurgeCount = " . $this->autoPurgeCount . "\n" . + "simplePieCacheDuration = " . $this->simplePieCacheDuration . "\n" . + "feedFetcherTimeout = " . $this->feedFetcherTimeout . "\n" . + "useCronUpdates = " . var_export($this->useCronUpdates, true) + ; + + $this->fileSystem->file_put_contents($configPath, $ini); } |