summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-12-01 16:37:29 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2014-12-01 16:37:29 +0100
commit0769556989f3426d1c8ab51043518e2748b143fe (patch)
treea32f4b4cf9fd1904dec339aed3e52da09c7171fa /lib
parent8db4dd7585aa9daebb32a3f3305f4061b17c316d (diff)
parentfc116f563fec20447e7300605d940cada975154c (diff)
downloadnextcloud-server-0769556989f3426d1c8ab51043518e2748b143fe.tar.gz
nextcloud-server-0769556989f3426d1c8ab51043518e2748b143fe.zip
Merge pull request #12419 from owncloud/read-only-config
Allow read-only configuration
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php6
-rw-r--r--lib/private/helper.php8
2 files changed, 11 insertions, 3 deletions
diff --git a/lib/base.php b/lib/base.php
index cd5d8feb1f6..74b668551ab 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -188,9 +188,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 d43eefcdc52..0e302275540 100644
--- a/lib/private/helper.php
+++ b/lib/private/helper.php
@@ -973,4 +973,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);
+ }
}