Try to read the file only instead of trying to touch

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
This commit is contained in:
Lukas Reschke 2014-11-12 15:56:02 +01:00
parent 5aaea6961c
commit 49ddaf9489
1 changed files with 3 additions and 3 deletions

View File

@ -138,12 +138,12 @@ class Config {
// Include file and merge config
foreach ($configFiles as $file) {
if($file === $this->configFilePath && !@touch($file)) {
// 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)) {