diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-01-27 16:16:31 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-01-27 16:16:31 +0100 |
commit | 816c23c17a71443d8774107d54ada8bda7486f32 (patch) | |
tree | 0a4a27f159334b51bbaa686ab9fb94d95466fecd /lib/private | |
parent | 6973718fb8cb8d5c5c27690675079b2ef574abd1 (diff) | |
parent | 8a4e1fbecde952fe86e1345b3d274c2c8b5778a8 (diff) | |
download | nextcloud-server-816c23c17a71443d8774107d54ada8bda7486f32.tar.gz nextcloud-server-816c23c17a71443d8774107d54ada8bda7486f32.zip |
Merge pull request #21923 from owncloud/fix-errors-after-install
Fix errors after install
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/config.php | 2 | ||||
-rw-r--r-- | lib/private/log/owncloud.php | 23 |
2 files changed, 13 insertions, 12 deletions
diff --git a/lib/private/config.php b/lib/private/config.php index 30baa3fe0e6..368dafd0460 100644 --- a/lib/private/config.php +++ b/lib/private/config.php @@ -184,7 +184,7 @@ class Config { // Include file and merge config foreach ($configFiles as $file) { - $filePointer = @fopen($file, 'r'); + $filePointer = file_exists($file) ? fopen($file, 'r') : false; if($file === $this->configFilePath && $filePointer === false && @!file_exists($this->configFilePath)) { diff --git a/lib/private/log/owncloud.php b/lib/private/log/owncloud.php index f9ce671aa93..dabf95d7616 100644 --- a/lib/private/log/owncloud.php +++ b/lib/private/log/owncloud.php @@ -43,17 +43,18 @@ class OC_Log_Owncloud { $defaultLogFile = $systemConfig->getValue("datadirectory", OC::$SERVERROOT.'/data').'/owncloud.log'; self::$logFile = $systemConfig->getValue("logfile", $defaultLogFile); - /* - * Fall back to default log file if specified logfile does not exist - * and can not be created. Error suppression is required in order to - * not end up in the error handler which will try to log the error. - * A better solution (compared to error suppression) would be checking - * !is_writable(dirname(self::$logFile)) before touch(), but - * is_writable() on directories used to be pretty unreliable on Windows - * for at least some time. - */ - if (!file_exists(self::$logFile) && !@touch(self::$logFile)) { - self::$logFile = $defaultLogFile; + /** + * Fall back to default log file if specified logfile does not exist + * and can not be created. + */ + if (!file_exists(self::$logFile)) { + if(!is_writable(dirname(self::$logFile))) { + self::$logFile = $defaultLogFile; + } else { + if(!touch(self::$logFile)) { + self::$logFile = $defaultLogFile; + } + } } } |