gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r23481 - gauger/web


From: gnunet
Subject: [GNUnet-SVN] r23481 - gauger/web
Date: Tue, 28 Aug 2012 18:45:59 +0200

Author: bartpolot
Date: 2012-08-28 18:45:59 +0200 (Tue, 28 Aug 2012)
New Revision: 23481

Modified:
   gauger/web/io.php
   gauger/web/readrange.php
   gauger/web/template_welcome.php
Log:
- Improved ranger detection and resetting


Modified: gauger/web/io.php
===================================================================
--- gauger/web/io.php   2012-08-28 15:11:54 UTC (rev 23480)
+++ gauger/web/io.php   2012-08-28 16:45:59 UTC (rev 23481)
@@ -136,6 +136,28 @@
 }
 
 /**
+ * set_range_global: set global range of data considering the new revision
+ * @param min new minimum
+ * @param max new maximum
+ */
+function set_range_global($min, $max) {
+    global $DATADIR;
+
+    $filename = $DATADIR.'global_range.dat';
+
+    $f = @fopen($filename, "w");
+    if($f === false) {
+        echo "WARNING: could not open range file $filename";
+        return;
+    }
+    flock($f, LOCK_EX);
+    fwrite($f, "$min $max");
+    flock($f, LOCK_UN);
+    fclose($f);
+}
+
+
+/**
  * add_range_global: set global range of data considering the new revision
  * @param data new revision
  */

Modified: gauger/web/readrange.php
===================================================================
--- gauger/web/readrange.php    2012-08-28 15:11:54 UTC (rev 23480)
+++ gauger/web/readrange.php    2012-08-28 16:45:59 UTC (rev 23481)
@@ -24,7 +24,16 @@
 init_params();
 explore();
 
+error_reporting(E_ALL);
+ini_set('display_errors', 1);
+
 list ($min, $max) = get_range_global();
+if (!is_numeric($min))
+   $min = PHP_INT_MAX;
+if (!is_numeric($max))
+   $max = 0;
+
+
 foreach($hosts as $host => $counters) {
     foreach($counters as $counter) {
         list($lmin, $lmax) = get_range($host, $counter);
@@ -33,7 +42,6 @@
     }
 }
 
-add_range_global($min);
-add_range_global($max);
+set_range_global($min, $max);
 
 header('Location: ' . url(), TRUE, 302);

Modified: gauger/web/template_welcome.php
===================================================================
--- gauger/web/template_welcome.php     2012-08-28 15:11:54 UTC (rev 23480)
+++ gauger/web/template_welcome.php     2012-08-28 16:45:59 UTC (rev 23481)
@@ -25,7 +25,8 @@
  <a href="<?php echo url("readrange.php") ?>" title="Fix global range by 
scanning all available data.">Wrong range?</a>
 </p>
  <?php else: ?>
-<p>Looks like there is no data in this Gauger installation. You maybe want to 
<a href="registration">register here</a> some new hosts and start logging data 
from them.</p>
+<p>Looks like there is no data in this Gauger installation. You maybe want to 
<a href="registration">register here</a> some new hosts and start logging data 
from them. <a href="<?php echo url("readrange.php") ?>" title="Fix global range 
by scanning all available data.">Wrong range?</a>
+</p>
  <?php endif;?>
 
 <p>If you click on a host from the <b>Hosts</b> menu on the left, you will see 
all the metrics for that particular host. </p>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]