diff options
author | Lukas Reschke <lukas@owncloud.com> | 2014-12-05 17:32:19 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2014-12-06 14:00:14 +0100 |
commit | bd520d2e53475d8e6a311b0a7fb6e605889e2f57 (patch) | |
tree | 6ff0d2d8e68afe8b084187f4f7ae877cd479b24c /lib/base.php | |
parent | 94eb2e782fa164492dd2665e6651eaa7068039aa (diff) | |
download | nextcloud-server-bd520d2e53475d8e6a311b0a7fb6e605889e2f57.tar.gz nextcloud-server-bd520d2e53475d8e6a311b0a7fb6e605889e2f57.zip |
Create config if it does not exists
The codepath that is executed when executing ownCloud via CLI is different than via browser. Specifically, the config is created by the user session already in `OC_Util::getInstanceId()` by a call to `setValue`. That said, this seems to be quite a bad side-effect, but for the sake of "not breaking whatever might break if we touch this" let's keep it that way for now.
When executing the autoconfig via `php -f index.php` the said session was not setup and thus no `config/config.php` file was created resulting in an installation error.
To reproduce this try to setup ownCloud via `php -f index.php` with and without that patch. (ensure to delete all existing configs before and don't access ownCloud with a browser in the meantime)
Fixes itself.
Diffstat (limited to 'lib/base.php')
-rw-r--r-- | lib/base.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/base.php b/lib/base.php index 7d70f98452f..a019e9a0009 100644 --- a/lib/base.php +++ b/lib/base.php @@ -188,7 +188,15 @@ class OC { public static function checkConfig() { $l = \OC::$server->getL10N('lib'); - $configFileWritable = file_exists(self::$configDir . "/config.php") && is_writable(self::$configDir . "/config.php"); + + // Create config in case it does not already exists + $configFilePath = self::$configDir .'/config.php'; + if(!file_exists($configFilePath)) { + @touch($configFilePath); + } + + // Check if config is writable + $configFileWritable = is_writable($configFilePath); if (!$configFileWritable && !OC_Helper::isReadOnlyConfigEnabled() || !$configFileWritable && \OCP\Util::needUpgrade()) { if (self::$CLI) { |