File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -184,7 +184,7 @@ private function readData() {
184184
185185 // Include file and merge config
186186 foreach ($ configFiles as $ file ) {
187- $ filePointer = @ fopen ($ file , 'r ' );
187+ $ filePointer = file_exists ( $ file ) ? fopen ($ file , 'r ' ) : false ;
188188 if ($ file === $ this ->configFilePath &&
189189 $ filePointer === false &&
190190 @!file_exists ($ this ->configFilePath )) {
Original file line number Diff line number Diff line change @@ -43,17 +43,18 @@ public static function init() {
4343 $ defaultLogFile = $ systemConfig ->getValue ("datadirectory " , OC ::$ SERVERROOT .'/data ' ).'/owncloud.log ' ;
4444 self ::$ logFile = $ systemConfig ->getValue ("logfile " , $ defaultLogFile );
4545
46- /*
47- * Fall back to default log file if specified logfile does not exist
48- * and can not be created. Error suppression is required in order to
49- * not end up in the error handler which will try to log the error.
50- * A better solution (compared to error suppression) would be checking
51- * !is_writable(dirname(self::$logFile)) before touch(), but
52- * is_writable() on directories used to be pretty unreliable on Windows
53- * for at least some time.
54- */
55- if (!file_exists (self ::$ logFile ) && !@touch (self ::$ logFile )) {
56- self ::$ logFile = $ defaultLogFile ;
46+ /**
47+ * Fall back to default log file if specified logfile does not exist
48+ * and can not be created.
49+ */
50+ if (!file_exists (self ::$ logFile )) {
51+ if (!is_writable (dirname (self ::$ logFile ))) {
52+ self ::$ logFile = $ defaultLogFile ;
53+ } else {
54+ if (!touch (self ::$ logFile )) {
55+ self ::$ logFile = $ defaultLogFile ;
56+ }
57+ }
5758 }
5859 }
5960
You can’t perform that action at this time.
0 commit comments