Commit ca8c7d99 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Remove outdated (and broken) mirror stats

parent e4481187
......@@ -3,7 +3,7 @@ SUBDIR = doc security support vlc videolan projects developers locale press vlmc
# Files to be preprocessed
#PHP_FILES = # automatic
PHP_IGNORES = mirror mirror-geo retrieve get_count mirror-geo-redirect
PHP_IGNORES =
# Additionnal dependencies
......
<?php
require '/home/videolan/etc/db.php';
/* Open the current */
$lines = file( "/var/www/local/www.videolan.org/counter.data" );
if( $lines == FALSE )
{
$old = "0 0\n";
}
else
{
$old = $lines[1];
}
/* Retrieve new data */
$connect = pg_connect( $connect_string );
if( !$connect )
{
die;
}
$request = pg_query($connect, "select sum(number) from (select * from mirrors where file like '%1.0.%' union all select * from mirrors_archive where file like '%1.0.%') as allmirrors;" );
if( $row = pg_fetch_array($request) )
{
$new = date( "U" )." ".$row[0]."\n";
}
pg_close($connect);
/* Write data */
$file = fopen( "/var/www/local/www.videolan.org/counter.data", "w" );
fwrite( $file, $old );
fwrite( $file, $new );
?>
<?php header('Content-Type: text/xml');
echo "<?xml version=\"1.0\"?>";
/* Open data */
$lines = file( "/var/www/local/www.videolan.org/counter.data" );
if( $lines == FALSE )
{
die;
}
$new = explode( " ",rtrim( $lines[1] ), 2 );
$old = explode( " ",rtrim( $lines[0] ), 2 ) ;
$now = date ("U" );
$rate = ($new[1] - $old[1] ) / ( $new[0] - $old[0] ) ;
$delay = $now - $new[0] ;
echo "<counter><count>".$new[1]."</count>";
echo "<rate>".sprintf( "%.1f" , $rate )."</rate>";
echo "<delay>".$delay."</delay>";
echo "</counter>";
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment