FileWriter Class Reference

Sortie en fichier. More...

Inherits SplObserver.

List of all members.

Public Member Functions

Private Attributes


Detailed Description

Sortie en fichier.

Definition at line 140 of file osC_ErrorHandler.php.


Constructor & Destructor Documentation

FileWriter::__construct ( filepath  ) 

Definition at line 144 of file osC_ErrorHandler.php.

00145     {
00146         $this->maxSize= 5 * 1024 * 1024;
00147           $intFileSize = @filesize($filepath);
00148           if ( $intFileSize >= $this->maxSize) {
00149             //On archive le fichier
00150             $strFileContent = file_get_contents($filepath);
00151             $strToFileGz = $filepath . '.' . date('Ymd_His') . '.gz';
00152             $strFileContentGz = gzencode($strFileContent,9);
00153             $objFileGz = @fopen($strToFileGz, 'w+');
00154             fwrite($objFileGz,$strFileContentGz);
00155             fclose($objFileGz);
00156             //On suprime le fichier
00157             unlink($filepath);
00158           }
00159             if (FALSE === $this->_fp = @fopen($filepath,'a+')) {
00160                 throw new Exception('Impossible d\'ouvrir le fichier de log');
00161             }
00162 
00163     }


Member Function Documentation

FileWriter::update ( SplSubject errorHandler  ) 

Definition at line 165 of file osC_ErrorHandler.php.

00166     {
00167       @fputs($this->_fp,
00168         (function_exists('tep_strftime')
00169           ?  tep_strftime(STORE_PARSE_DATE_TIME_FORMAT).' '
00170           : '' ) .
00171         $errorHandler->getError() . PHP_EOL);
00172     }


Member Data Documentation

FileWriter::$_fp [private]

Definition at line 141 of file osC_ErrorHandler.php.

FileWriter::$maxSize [private]

Definition at line 142 of file osC_ErrorHandler.php.


The documentation for this class was generated from the following file: