Changeset 7781 for trunk/src/inc
- Timestamp:
- Apr 16, 2010, 6:23:53 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/inc/FileHandler.class.php
r7780 r7781 9 9 private $filename; 10 10 private $handle; 11 11 12 12 /* 13 13 * Function: __construct (constructor) 14 * Description: Handling with a node file 14 * Description: Handling with a node file 15 15 * Parameters: string $filename, string $mode 16 16 * Returns: true is we've succesfully opened the file, otherwise false … … 50 50 } 51 51 52 53 54 55 56 57 58 52 /* 59 53 * Function: write 60 * Description: Try to write to the file we've opened in the constructor 54 * Description: Try to write to the file we've opened in the constructor 61 55 * Parameters: string $data 62 56 * Returns: true if we can write to the file, otherwise false 63 57 */ 64 58 public function write($data) { 65 66 $filename = date( "m_d_y.kml" ); 67 68 69 try{ 70 trigger_log(SYSLOG_DEBUG, 'Opening the file "' . $filename . '"', __FILE__, __LINE__); 71 $file = new FileHandler($filename, 'w'); 72 } catch (Exception $err) { 73 trigger_log(SYSLOG_ERR, 'Opening the file "' . $filename . '"', __FILE__, __LINE__); 74 return false; 75 } 76 77 try{ 78 trigger_log(SYSLOG_DEBUG, 'Writing file "' . $filename . '"', __FILE__, __LINE__); 59 trigger_log(SYSLOG_DEBUG, 'Writing file "' . $this->filename . '"', __FILE__, __LINE__); 60 61 try { 79 62 $file->write($file,$this->$data); 80 } catch (Exception $err) { 81 trigger_log(SYSLOG_ERR, 'Writing the file "' . $filename . '"', __FILE__, __LINE__); 82 return false; 83 } 84 85 86 try{ 87 trigger_log(SYSLOG_DEBUG, 'Closing file "' . $filename . '"', __FILE__, __LINE__); 88 fclose($file); 89 } catch (Exception $err) { 90 trigger_log(SYSLOG_ERR, 'Closing the file "' . $filename . '"', __FILE__, __LINE__); 91 return false; 92 } 93 94 return true; 95 63 } catch (Exception $err) { 64 trigger_log(SYSLOG_ERR, 'Couldn\'t write to file "' . $this->filename . '"', __FILE__, __LINE__); 65 return false; 66 } 96 67 97 68 return true; 98 69 } 99 70
Note:
See TracChangeset
for help on using the changeset viewer.