[Pkg-owncloud-commits] [owncloud] 04/12: Create config if it does not exists
David Prévot
taffit at moszumanska.debian.org
Tue Dec 9 22:47:24 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit 55ebf024a7e1eac73e77c8389794f89471ee48d4
Author: Lukas Reschke <lukas at owncloud.com>
Date: Fri Dec 5 17:32:19 2014 +0100
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.
---
lib/base.php | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lib/base.php b/lib/base.php
index e99159d..d653e06 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -188,7 +188,15 @@ class OC {
public static function checkConfig() {
$l = OC_L10N::get('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) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list