summaryrefslogtreecommitdiffstats
path: root/utility
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-09-02 03:19:42 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-09-02 03:19:42 +0200
commitb512f045446942f802740764d5b4178c97205a37 (patch)
tree4562f14d5a1b21df33a18e402706611187546238 /utility
parent38297af11f458b30af3cbdc42cf3407d6aff44ab (diff)
switch from json config to ini config
Diffstat (limited to 'utility')
-rw-r--r--utility/config.php24
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);
}