[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r22584 - in gauger: . web
From: |
gnunet |
Subject: |
[GNUnet-SVN] r22584 - in gauger: . web |
Date: |
Tue, 10 Jul 2012 04:01:51 +0200 |
Author: bartpolot
Date: 2012-07-10 04:01:51 +0200 (Tue, 10 Jul 2012)
New Revision: 22584
Added:
gauger/web/readrange.php
Modified:
gauger/README
gauger/web/io.php
gauger/web/template.php
gauger/web/template_welcome.php
Log:
- fixed range file creation, fixed datadir usage, added range check, updated
documentation
Modified: gauger/README
===================================================================
--- gauger/README 2012-07-09 21:57:23 UTC (rev 22583)
+++ gauger/README 2012-07-10 02:01:51 UTC (rev 22584)
@@ -45,7 +45,8 @@
authentication data.
* Section config
Should contain:
- * A path where to put the data logged from clients
+ * A path where to put the data logged from clients. The path is expected
+ to be relative to the installation root, if not started by /.
* A salt to protect the password hashes, which should be a unique string
for each gauger installation. By default it includes a random 15 bit
number
Modified: gauger/web/io.php
===================================================================
--- gauger/web/io.php 2012-07-09 21:57:23 UTC (rev 22583)
+++ gauger/web/io.php 2012-07-10 02:01:51 UTC (rev 22584)
@@ -1,8 +1,8 @@
<?php
-/** explore.php
+/** io.php
This file is part of gauger.
- Copyright 2011 Bartlomiej Polot
+ Copyright 2011-2012 Bartlomiej Polot
gauger is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
@@ -141,8 +141,19 @@
*/
function add_range_global($data) {
global $DATADIR;
- $f = @fopen($DATADIR.'global_range.dat', 'r+');
- if($f === false) return;
+
+ $filename = $DATADIR.'global_range.dat';
+
+ if (file_exists($filename)) {
+ $fmode = "r+";
+ } else {
+ $fmode = "w+";
+ }
+ $f = @fopen($filename, $fmode);
+ if($f === false) {
+ echo "WARNING: could not open range file $filename";
+ return;
+ }
flock($f, LOCK_EX);
$range = explode(' ', fgets($f, 512));
if(count($range) < 2) {
@@ -522,8 +533,12 @@
function add_data_to_host($h, $g, $rev, $value) {
global $CONF;
global $DATADIR;
- $datadir = preg_replace('/(.*)\/.*/', '\1', $_SERVER['SCRIPT_FILENAME']);
- $datadir .= '/' . $DATADIR;
+ if ($DATADIR[0] == '/') {
+ $datadir = $DATADIR;
+ } else {
+ $datadir = preg_replace('/(.*)\/.*/', '\1',
$_SERVER['SCRIPT_FILENAME']);
+ $datadir .= '/' . $DATADIR;
+ }
check_permissions($datadir, 'dir');
$datadir .= '/' . remove_slashes($h);
check_permissions($datadir, 'dir');
Added: gauger/web/readrange.php
===================================================================
--- gauger/web/readrange.php (rev 0)
+++ gauger/web/readrange.php 2012-07-10 02:01:51 UTC (rev 22584)
@@ -0,0 +1,39 @@
+<?php
+/** readrange.php
+
+ This file is part of gauger.
+ Copyright 2012 Bartlomiej Polot
+
+ gauger is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ gauger is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with gauger. If not, see <http://www.gnu.org/licenses/>.
+*/
+$basedir = preg_replace('/(.*)\/.*/','\1',$_SERVER['SCRIPT_NAME']);
+include "helper.php";
+include "params.php"; // Manage all parameters given by the user
+include "io.php"; // Gather all existing hosts and counters
+init_params();
+explore();
+
+list ($min, $max) = get_range_global();
+foreach($hosts as $host => $counters) {
+ foreach($counters as $counter) {
+ list($lmin, $lmax) = get_range($host, $counter);
+ $min = min($min, $lmin);
+ $max = max($max, $lmax);
+ }
+}
+
+add_range_global($min);
+add_range_global($max);
+
+header('Location: ' . url(), TRUE, 302);
Modified: gauger/web/template.php
===================================================================
--- gauger/web/template.php 2012-07-09 21:57:23 UTC (rev 22583)
+++ gauger/web/template.php 2012-07-10 02:01:51 UTC (rev 22584)
@@ -568,7 +568,7 @@
<p>Copyright 2011 Bartlomiej Polot (address@hidden)</p>
<p>This software is distributed under the <a target="_blank"
href="http://www.gnu.org/licenses/agpl.html">GNU AGPL</a></p>
<p>
- <a target="_blank"
href="https://gnunet.org/gauger/gauger-1.0.tar.gz">gauger version 1.0</a> |
+ gauger version pre-1.1 |
<a target="_blank"
href="https://gnunet.org/gauger/index.php">Project Main Page</a> |
<a target="_blank" href="https://gnunet.org/svn/gauger">SVN
repository</a>
</p>
Modified: gauger/web/template_welcome.php
===================================================================
--- gauger/web/template_welcome.php 2012-07-09 21:57:23 UTC (rev 22583)
+++ gauger/web/template_welcome.php 2012-07-10 02:01:51 UTC (rev 22584)
@@ -2,7 +2,7 @@
/** template_welcome.php
This file is part of gauger.
- Copyright 2011 Bartlomiej Polot
+ Copyright 2011-2012 Bartlomiej Polot
gauger is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
@@ -22,6 +22,8 @@
<?php if(get_session('xrange_min') != ''): ?>
<p>We have data from <b>r<?php echo get_session('xrange_min') ?></b> to
<b>r<?php echo get_session('xrange_max') ?></b>.
+ <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>
<?php endif;?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r22584 - in gauger: . web,
gnunet <=