Merge pull request #7885 from owncloud/extstorage-prettyprintjson

Pretty print mount.json when possible
This commit is contained in:
Vincent Petry 2014-03-26 13:34:31 +01:00
commit 028973cbea
1 changed files with 6 additions and 1 deletions

View File

@ -538,7 +538,12 @@ class OC_Mount_Config {
$datadir = \OC_Config::getValue('datadirectory', \OC::$SERVERROOT . '/data/');
$file = \OC_Config::getValue('mount_file', $datadir . '/mount.json');
}
$content = json_encode($data);
$options = 0;
if (defined('JSON_PRETTY_PRINT')) {
// only for PHP >= 5.4
$options = JSON_PRETTY_PRINT;
}
$content = json_encode($data, $options);
@file_put_contents($file, $content);
@chmod($file, 0640);
}