Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix errors after install #21923

Merged
merged 1 commit into from
Jan 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/private/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ private function readData() {

// 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)) {
Expand Down
23 changes: 12 additions & 11 deletions lib/private/log/owncloud.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,18 @@ public static function init() {
$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;
}
}
}
}

Expand Down