Changeset 6397
- Timestamp:
- 12/09/07 19:44:53 (2 years ago)
- Files:
-
- trunk/lib/log/sfFileLogger.class.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/log/sfFileLogger.class.php
r5109 r6397 27 27 * Available options: 28 28 * 29 * - file: The file path or a php wrapper to log messages 30 * You can use any support php wrapper. To write logs to the Apache error log, use php://stderr 29 * - file: The file path or a php wrapper to log messages 30 * You can use any support php wrapper. To write logs to the Apache error log, use php://stderr 31 * - dir_mode: The mode to use when creating a directory (default to 0777) 32 * - file_mode: The mode to use when creating a file (default to 0666) 31 33 * 32 34 * @param sfEventDispatcher A sfEventDispatcher instance … … 45 47 if (!is_dir($dir)) 46 48 { 47 mkdir($dir, 0777, true);49 mkdir($dir, isset($options['dir_mode']) ? $options['dir_mode'] : 0777, true); 48 50 } 49 51 50 if (!is_writable($dir) || ( file_exists($options['file']) && !is_writable($options['file'])))52 if (!is_writable($dir) || ($fileExists = file_exists($options['file']) && !is_writable($options['file']))) 51 53 { 52 54 throw new sfFileException(sprintf('Unable to open the log file "%s" for writing.', $options['file'])); … … 54 56 55 57 $this->fp = fopen($options['file'], 'a'); 58 if (!$fileExists) 59 { 60 chmod($options['file'], isset($options['file_mode']) ? $options['file_mode'] : 0666); 61 } 56 62 57 63 return parent::initialize($dispatcher, $options);

