Changeset 7845 for trunk/src/inc/LogHandler.class.php
- Timestamp:
- Apr 18, 2010, 11:17:31 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/inc/LogHandler.class.php
r7843 r7845 91 91 } 92 92 if ((!defined('IGNORE_LOG_LEVEL_WRITE')) && ($logno <= LOG_LEVEL_WRITE)) { 93 $filename = 'logfile.txt'; 94 if (is_writable($filename)) { 95 96 //Check if the file can be opened 97 if (!$handle = fopen($filename, 'a')) { 98 define('IGNORE_LOG_LEVEL_WRITE', true); 99 trigger_log(SYSLOG_EMERG, 'Cannot open file "' . $filename . '"', __FILE__, __LINE__); 100 exit; 101 } 102 103 // Write $errorString to file. 104 if (fwrite($handle, $errorString) === FALSE) { 105 define('LOG_LEVEL_WRITE', LOG_LEVEL_NONE); 106 trigger_log(SYSLOG_EMERG, 'Cannot write to "' . $filename . '"', __FILE__, __LINE__); 107 exit; 108 } 109 110 fclose($handle); 111 112 } else { 93 global $config; 94 $filename = $config['log_file']; 95 //XXX: Trying to write to a file that a the file cannot be opened 96 // what could possible go wrong 97 //Check if the file can be opened 98 if (!$handle = fopen($filename, 'a+')) { 113 99 define('IGNORE_LOG_LEVEL_WRITE', true); 100 trigger_log(SYSLOG_EMERG, 'Cannot open file "' . $filename . '"', __FILE__, __LINE__); 101 exit; 102 } 103 104 // Write $errorString to file. 105 if (fwrite($handle, $errorString) === FALSE) { 106 define('LOG_LEVEL_WRITE', LOG_LEVEL_NONE); 114 107 trigger_log(SYSLOG_EMERG, 'Cannot write to "' . $filename . '"', __FILE__, __LINE__); 108 exit; 115 109 } 110 111 fclose($handle); 116 112 } 117 113
Note:
See TracChangeset
for help on using the changeset viewer.