diff options
author | Lukas Reschke <lukas@owncloud.com> | 2014-11-25 16:12:12 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2014-11-25 16:26:47 +0100 |
commit | fc116f563fec20447e7300605d940cada975154c (patch) | |
tree | 0118df1fba46e54ecf821f84ba388e26ecae4e37 /lib | |
parent | 553188273c24835b2f8e36e488208f486d674bfc (diff) | |
download | nextcloud-server-fc116f563fec20447e7300605d940cada975154c.tar.gz nextcloud-server-fc116f563fec20447e7300605d940cada975154c.zip |
Allow read-only configuration
Workaround required for IIS setups running ownCloud to prevent dataloss.
Long-term solution would be to move some configuration settings to the database
Diffstat (limited to 'lib')
-rw-r--r-- | lib/base.php | 6 | ||||
-rw-r--r-- | lib/private/helper.php | 8 |
2 files changed, 11 insertions, 3 deletions
diff --git a/lib/base.php b/lib/base.php index 82c0c7aa6d0..0c9dbb30a73 100644 --- a/lib/base.php +++ b/lib/base.php @@ -194,9 +194,9 @@ class OC { public static function checkConfig() { $l = \OC::$server->getL10N('lib'); - if (file_exists(self::$configDir . "/config.php") - and !is_writable(self::$configDir . "/config.php") - ) { + $configFileWritable = file_exists(self::$configDir . "/config.php") && is_writable(self::$configDir . "/config.php"); + if (!$configFileWritable && !OC_Helper::isReadOnlyConfigEnabled() + || !$configFileWritable && \OCP\Util::needUpgrade()) { if (self::$CLI) { echo $l->t('Cannot write into "config" directory!')."\n"; echo $l->t('This can usually be fixed by giving the webserver write access to the config directory')."\n"; diff --git a/lib/private/helper.php b/lib/private/helper.php index be448b8ff9b..5f46c1311cc 100644 --- a/lib/private/helper.php +++ b/lib/private/helper.php @@ -974,4 +974,12 @@ class OC_Helper { return array('free' => $free, 'used' => $used, 'total' => $total, 'relative' => $relative); } + + /** + * Returns whether the config file is set manually to read-only + * @return bool + */ + public static function isReadOnlyConfigEnabled() { + return \OC::$server->getConfig()->getSystemValue('config_is_read_only', false); + } } |