Mirror repository metadata check
 'Enterprise Linux 7',
	'enterprise/6'	=> 'Enterprise Linux 6',
	'enterprise/5'	=> 'Enterprise Linux 5',
	'fedora/22'	=> 'Fedora 22',
	'fedora/21' 	=> 'Fedora 21',
	'fedora/20' 	=> 'Fedora 20',
);
$subs = array(
	'remi',
	'test',
	'php56',
);
$archs = array(
	'i386',
	'x86_64',
);
$mirrors = array(
	'http://remi.mirrors.arminco.com/', 
	'http://remi.conetix.com.au/',
	'http://mirrors.neterra.net/remi/',
	'http://remi.xpg.com.br/',
	'http://mirror5.layerjet.com/remi/',
	'http://remi.schlundtech.de/',
	'http://mirror.cedia.org.ec/remi/',
	'http://mirror.uta.edu.ec/remi/',
	'http://iut-info.univ-reims.fr/remirpms/',
	'http://mirror.smartmedia.net.id/remi/',
	'http://ftp.arnes.si/mirrors/remi/',
	'http://mirrors.thzhost.com/remi/',
	'http://remi.check-update.co.uk/',
	'http://mirrors.mediatemple.net/remi/',
	'http://fr2.rpmfind.net/linux/remi/',
	'http://mirror.awanti.com/remi/',
	'http://mirrors.netix.net/remi/',
	'http://mirror.h1host.ru/remi/',
	'http://remi.mirrors.cu.be/',
	'http://mirror.innosol.asia/remi/',
	'http://mirror.neolabs.kz/remi/',
	'http://mirror.lablus.com/remi/',
	'http://mirror.veriteknik.net.tr/remi/',
	'https://remi.mirror.ate.info/',
);
$deprecated = array(
	'http://remi.kazukioishi.net/',
	'http://remirpm.mirror.gymkl.ch/',
	'http://remi.mirror.net.in/',
	'http://remi-mirror.dedipower.com/',
	'http://mirror.beyondhosting.net/Remi/',
	'http://mirrors.cicku.me/remi/',
	'http://remi.mirrors.hostinginnederland.nl/',
	'http://mirror.1000mbps.com/remi/',
	'http://mirrors.hustunique.com/remi/',
	'http://mirror.pw/remi/',
);
function getRepoTime($uri) {
	$xml = @simplexml_load_file($uri.'/repodata/repomd.xml');
	if ($xml && $xml->revision) {
		return intval($xml->revision);
	}
	return 0;
}
if (isset($_GET['mirror']) && isset($repos[$_GET['mirror']])) {
	$path = $_GET['mirror'];
} else {
	$path = 'enterprise/7';
}
if (isset($_GET['repo']) && in_array($_GET['repo'], $subs)) {
	$repo = $_GET['repo'];
} else {
	$repo = 'remi';
}
if (isset($_GET['arch']) && in_array($_GET['arch'], $archs)) {
	$arch = $_GET['arch'];
} else {
	$arch = 'x86_64';
}
$name = $repos[$path];
$full = "$path/$repo/$arch";
if (!$cli) {
	echo "
\n";
	foreach ($repos as $rpath => $rname) {
		if ($path == $rpath) {
			printf("- %s\n", $rname);
		} else {
			printf("
- %s", $rpath, $rname);
		}
	}
	echo "
\n";
}
$pids = array();
$ref = getRepoTime($full);
if ($ref) {
	printf(($cli ? "Check of %s (%s)\n" : "
%s - %s
\n"), $name, date('r', $ref));
	if (!$cli) echo "
\n";
	foreach ($mirrors as $mirror) {
		if ($cli) {
			$pid = pcntl_fork();
			if ($pid<0) {
				die("Can't fork\n");
			} else if ($pid) {
				$pids[$pid] = $pid;
			} else { // Child
 				$pids = array();
				$loc = getRepoTime($mirror.$full);
				if ($ref == $loc) {
					printf("%50.50s: Ok\n", $mirror);
				} else if ($loc) {
					printf("%50.50s: %s\n", $mirror, date('r', $loc));
				} else {
					printf("%50.50s: N/A\n", $mirror);
				}
				break;
			}
			continue;
		}
		flush();
		$host = parse_url($mirror, PHP_URL_HOST);
		printf("- %s ", $mirror, $host);
		$loc = getRepoTime($mirror.$full);
		if ($ref == $loc) {
			printf("
- %s Ok\n", $mirror, $mirror);
		} else if ($loc) {
			printf("
- %s %s\n", $mirror, $mirror, date('r', $loc));
		} else {
			printf("
- %s N/A\n", $mirror, $mirror);
		}
	}
	if ($cli) {
		while (count($pids)) {
			printf("Wait %d\r", count($pids));
			$pid = pcntl_wait($status);
			if ($pid<0) {
				die("Cound not wait\n");
				exit (1);
			} else {
				unset($pids[$pid]);
			}
		}
	} else {
		echo "
\n";
	}
} else {
	printf("
%s - not found
\n", $name);
}
if (!$cli) {
?>