Add server count

pull/7/head
mdPlusPlus 2 years ago
parent 6ab837548a
commit 1272d9bdd1

@ -82,7 +82,7 @@
$final_html = create_html_page_from_html_data($table_html, $title, $timestamp);
// print_r($wild_join_links);
print_r($servers);
// print_r($servers);
// print_r($rooms);
// print_r($pubkeys);
// print_r($addr_assignments);
@ -92,7 +92,7 @@
// write output to disk
global $output;
file_put_contents($output, $final_html); // overwrites existing file
echo("Done. " . count($info_arrays) . " unique Session Communities have been found." . PHP_EOL);
echo("Done. " . count($info_arrays) . " unique Session Communities on " . count_servers($info_arrays) . " servers have been found." . PHP_EOL);
}
/*
@ -673,4 +673,22 @@
return $info_arrays;
}
/*
* Counts every unique server from given $info_arrays and returns the count
*/
function count_servers($info_arrays) {
$servers = array();
foreach($info_arrays as $i_arr) {
// https://sogs.example.com:1234/token?public_key=...
$join_link = $i_arr["join_link"];
$exploded = explode("/", $join_link); // https: + "" + sogs.example.com:1234 + token?public_key=...
$servers[] = $exploded[0] . "//" . $exploded[2];
}
$servers = array_unique($servers);
sort($servers);
// print_r($servers);
return count($servers);
}
?>

@ -80,7 +80,7 @@
"</table>" . PHP_EOL .
"<table id=\"tbl_footer\">" . PHP_EOL .
" <tr>" . PHP_EOL .
" <td id=\"td_summary\">" . count($table_lines) . " unique Session Communities have been found.</td>" . PHP_EOL .
" <td id=\"td_summary\">" . count($table_lines) . " unique Session Communities on " . count_servers($info_arrays) . " servers have been found.</td>" . PHP_EOL .
" </tr>" . PHP_EOL .
" <tr>" . PHP_EOL .
" <td id=\"td_last_checked\">Last checked X minutes ago.</td>" . PHP_EOL .

Loading…
Cancel
Save