cvs: phpweb /include site.inc

From: Date: Sat, 03 May 2003 20:07:23 +0000
Subject: cvs: phpweb /include site.inc
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-17266@lists.php.net to get a copy of this message
goba Sat May 3 16:07:23 2003 EDT Modified files: /phpweb/include site.inc Log: Add a function to count mirrors in a given country Index: phpweb/include/site.inc diff -u phpweb/include/site.inc:1.244 phpweb/include/site.inc:1.245 --- phpweb/include/site.inc:1.244 Sat May 3 11:49:18 2003 +++ phpweb/include/site.inc Sat May 3 16:07:23 2003 @@ -1,6 +1,6 @@ <?php // -*- C++ -*- -// $Id: site.inc,v 1.244 2003/05/03 15:49:18 goba Exp $ +// $Id: site.inc,v 1.245 2003/05/03 20:07:23 goba Exp $ // Define $MIRRORS array, and some constants include_once 'mirrors.inc'; @@ -106,6 +106,25 @@ global $MIRRORS, $MYSITE; if (!$site) { $site = $MYSITE; } return $MIRRORS[$site][7]; +} + +// Count all mirrors or mirrors in a given country +function count_mirrors($country = FALSE) +{ + global $MIRRORS; + + // This is a non-identified country + if ($country == "NA") { return 0; } + + // Count all mirror sites + elseif ($country === FALSE) { return count($MIRRORS); } + + // Count only the ones in the same country + $count = 0; + foreach ($MIRRORS as $murl => $mirror) { + if (mirror_country($murl) == $country) { $count++; } + } + return $count; } // Redirect to an URI on this mirror

« previous php.mirrors (#17266) next »