[Nextcms-commits] CVS: nextcms class.Log.php,1.4,1.5 processor.conf.php-dist,1.6,1.7
Status: Alpha
Brought to you by:
andrejb
|
From: Andrej B. <an...@us...> - 2002-05-02 17:13:51
|
Update of /cvsroot/nextcms/nextcms
In directory usw-pr-cvs1:/tmp/cvs-serv23512
Modified Files:
class.Log.php processor.conf.php-dist
Log Message:
experimental logfile compression
Index: class.Log.php
===================================================================
RCS file: /cvsroot/nextcms/nextcms/class.Log.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** class.Log.php 5 Apr 2002 14:45:09 -0000 1.4
--- class.Log.php 2 May 2002 17:13:47 -0000 1.5
***************
*** 36,39 ****
--- 36,59 ----
fclose($f);
+
+ if (isset($GLOBALS['LOG_MAX_SIZE'])) {
+ if (filesize($log_filename) > ($GLOBALS['LOG_MAX_SIZE'] << 10)) {
+ if (isset($GLOBALS['LOG_COMPRESSION_COMMAND'])) {
+ if (isset($GLOBALS['LOG_COMPRESSION_EXTENSION']))
+ $ext = $GLOBALS['LOG_COMPRESSION_EXTENSION']; else $ext = '';
+
+ $testname = $log_filename . '.' . date('Ymd');
+
+ $outfile = $testname . $ext;
+ for ($i=1;file_exists($outfile);$i++)
+ $outfile = $testname . '.' . $i . $ext;
+
+ $trans = array('{infile}' => $log_filename, '{outfile}' => $outfile);
+ $cmd = strtr($GLOBALS['LOG_COMPRESSION_COMMAND'], $trans);
+ exec($cmd);
+ }
+ unlink($log_filename);
+ }
+ }
}
}
Index: processor.conf.php-dist
===================================================================
RCS file: /cvsroot/nextcms/nextcms/processor.conf.php-dist,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** processor.conf.php-dist 30 Apr 2002 23:58:18 -0000 1.6
--- processor.conf.php-dist 2 May 2002 17:13:47 -0000 1.7
***************
*** 18,21 ****
--- 18,28 ----
$LOG_FILE = $LOG_DIR . '/site.log';
+ // maximum log file size in kbyte
+ // $LOG_MAX_SIZE = 1000;
+
+ // command which is called when log size limit is reached
+ // $LOG_COMPRESSION_COMMAND = "gzip -c {infile} > {outfile}";
+ // $LOG_COMPRESSION_EXTENSION = ".gz";
+
// if $CACHE_DIR is set caching is enabled
// remember to set write permissions
|