diff options
Diffstat (limited to 'php/admin/lstats.php')
-rw-r--r-- | php/admin/lstats.php | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/php/admin/lstats.php b/php/admin/lstats.php new file mode 100644 index 0000000..f7f1900 --- /dev/null +++ b/php/admin/lstats.php @@ -0,0 +1,59 @@ +<?php +/** + * Location Statistics. + * @package mirror + * @subpackage admin + */ +$protect=1; // protect this page +require_once('../cfg/init.php'); + +$stats = db_get(" + SELECT + IF(mirror_location_mirror_map.location_active='0','DISABLED','ok') as location_active, + mirror_name, + mirror_baseurl, + location_path + FROM + mirror_mirrors, + mirror_location_mirror_map, + mirror_locations + WHERE + mirror_mirrors.mirror_id = mirror_location_mirror_map.mirror_id AND + mirror_locations.location_id = mirror_location_mirror_map.location_id +",MYSQL_ASSOC); + +$_GET['sort']=(!empty($_GET['sort']))?$_GET['sort']:'location_active'; +$_GET['order']=(!empty($_GET['order']))?$_GET['order']:'ASC'; +$stats=array_order_by($stats,$_GET['sort'],$_GET['order']); + +$headers = array( + 'location_active'=>'Status', + 'mirror_name'=>'Host Name', + 'mirror_baseurl'=>'Address', + 'location_path'=>'Path' +); + +// should we export to csv? +if (!empty($_GET['csv'])) { + $csv = array(); + $csv[] = $headers; + foreach ($stats as $row) { + $csv[] = $row; + } + csv_send_csv($csv); + exit; +} + +$title = 'Location Statistics'; +$nav = INC.'/admin_nav.php'; +require_once(HEADER); +echo '<h2>Location Statistics</h2>'; + +echo '<p>This shows whether or not a server is serving up a certain file.</p>'; + +show_list($stats,$headers,'simple'); + +echo '<p><a href="./lstats.php?csv=1&sort='.$_GET['sort'].'&order='.$_GET['order'].'">Save this page as CSV »</a></p>'; + +require_once(FOOTER); +?> |