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://remi.schlundtech.de/',
'http://mirror.cedia.org.ec/remi/',
'http://mirror.uta.edu.ec/remi/',
'http://ftp.arnes.si/mirrors/remi/',
'http://mirrors.thzhost.com/remi/',
'http://mirrors.mediatemple.net/remi/',
'http://fr2.rpmfind.net/linux/remi/',
'http://mirror.awanti.com/remi/',
'http://mirrors.netix.net/remi/',
'http://remi.mirrors.cu.be/',
'http://mirror.innosol.asia/remi/',
'http://mirror.neolabs.kz/remi/',
'http://mirror.veriteknik.net.tr/remi/',
'https://remi.mirror.ate.info/',
'https://mirrors.tuna.tsinghua.edu.cn/remi/',
'http://mirror.23media.de/remi/',
'http://repo1.dal.innoscale.net/remi/',
'http://repo1.sea.innoscale.net/remi/',
'http://repo1.ash.innoscale.net/remi/',
'http://mirror.bebout.net/remi/',
'https://mirror.oxilion.nl/remi/',
'https://remi.mirror.wearetriple.com/',
'http://mirror.upb.edu.co/remi/',
'https://mirrors.uni-ruse.bg/remi/',
'https://remi.mirror.karneval.cz/',
'https://mirror.netsite.dk/remi/',
'http://mirror.nsw.coloau.com.au/remi/',
'http://mirror.team-cymru.com/remi/',
'http://mirror.reconn.ru/remi/',
'http://mirrors.ukfast.co.uk/sites/remi/',
'https://mirror.netweaver.uk/remi/',
'http://mirror.xeonbd.com/remi/',
'http://mirrors.mivocloud.com/remi/',
);
$deprecated = array(
'http://nl.mirror.babylon.network/remi/',
'http://fr.mirror.babylon.network/remi/',
'http://ca.mirror.babylon.network/remi/',
'http://mirror.h1host.ru/remi/',
'http://mirror5.layerjet.com/remi/',
'http://mirror.smartmedia.net.id/remi/',
'http://remi.check-update.co.uk/',
'http://iut-info.univ-reims.fr/remirpms/',
'http://mirror.lablus.com/remi/',
'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 %d mirrors of %s (%s)\n" : "
%s - %s
\n"), count($mirrors), $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) {
$nb=count($pids);
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]);
}
}
if ($nb) printf("%d mirrors checked.\n", $nb);
} else {
echo "
\n";
}
} else {
printf("
%s - not found
\n", $name);
}
if (!$cli) {
?>