Merge pull request #21923 from owncloud/fix-errors-after-install

Fix errors after install
This commit is contained in:
Thomas Müller 2016-01-27 16:16:31 +01:00
commit 816c23c17a
2 changed files with 13 additions and 12 deletions

View File

@ -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)) {

View File

@ -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.
* and can not be created.
*/
if (!file_exists(self::$logFile) && !@touch(self::$logFile)) {
if (!file_exists(self::$logFile)) {
if(!is_writable(dirname(self::$logFile))) {
self::$logFile = $defaultLogFile;
} else {
if(!touch(self::$logFile)) {
self::$logFile = $defaultLogFile;
}
}
}
}