mirror of
https://github.com/php/web-php.git
synced 2026-04-01 12:12:16 +02:00
Add a function to count mirrors in a given country
This commit is contained in:
@@ -108,6 +108,25 @@ function mirror_status($site = FALSE)
|
||||
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
|
||||
// site or outside this site
|
||||
function mirror_redirect($absoluteURI, $remote = FALSE)
|
||||
|
||||
Reference in New Issue
Block a user