]> source.dussan.org Git - nextcloud-server.git/commitdiff
Try to read the file only instead of trying to touch
authorLukas Reschke <lukas@owncloud.com>
Wed, 12 Nov 2014 14:56:02 +0000 (15:56 +0100)
committerLukas Reschke <lukas@owncloud.com>
Tue, 25 Nov 2014 13:40:52 +0000 (14:40 +0100)
The permissions are already catched properly on the installation so we just have to check whether the file is readable to prevent fatal errors from happening.

Fixes https://github.com/owncloud/core/issues/12135

Conflicts:
lib/private/config.php

lib/private/config.php

index 7bf3863e2a6d035442411508ef7de0fc98d06d69..cc07d6a1ed124baa4fafad20391bd285aafd0ee9 100644 (file)
@@ -138,12 +138,12 @@ class Config {
 
                // Include file and merge config
                foreach ($configFiles as $file) {
-                       if(!@touch($file) && $file === $this->configFilePath) {
-                               // Writing to the main config might not be possible, e.g. if the wrong
+                       $filePointer = @fopen($file, 'r');
+                       if($file === $this->configFilePath && $filePointer === false) {
+                               // Opening the main config might not be possible, e.g. if the wrong
                                // permissions are set (likely on a new installation)
                                continue;
                        }
-                       $filePointer = fopen($file, 'r');
 
                        // Try to acquire a file lock
                        if(!flock($filePointer, LOCK_SH)) {