modules/stats.php
changeset 15 5e2d1514ccd0
parent 8 0acb8d9a3194
child 17 b07b23187b17
--- a/modules/stats.php	Sat Oct 11 23:09:13 2008 +0000
+++ b/modules/stats.php	Sat Oct 11 20:28:32 2008 -0400
@@ -8,7 +8,8 @@
   'v' => '+'
 );
 $stats_data = array('anonymous' => array(), 'messages' => array());
-@include('./stats-data.php');
+$stats_day = gmdate('Ymd');
+@include("./stats/stats-data-$stats_day.php");
 unset($stats_data['members']);
 $stats_data['members'] =& $stats_memberlist;
 
@@ -232,6 +233,9 @@
 
 function stats_cron()
 {
+  global $stats_day;
+  $stats_day = gmdate('Ymd');
+  
   static $commit_time = 0;
   $now = time();
   // commit to disk every 1 minute
@@ -244,13 +248,13 @@
 
 function stats_commit()
 {
-  global $stats_data;
+  global $stats_data, $stats_day;
   ob_start();
   var_export($stats_data);
   $stats_data_exported = ob_get_contents();
   ob_end_clean();
   
-  $fp = @fopen('./stats-data.php', 'w');
+  $fp = @fopen("./stats/stats-data-$stats_day.php", 'w');
   if ( !$fp )
     return false;
   fwrite($fp, "<?php\n\$stats_data = $stats_data_exported;\n");