Mirror repository metadata check
'Enterprise Linux 8',
'enterprise/7' => 'Enterprise Linux 7',
'enterprise/6' => 'Enterprise Linux 6',
'fedora/31' => 'Fedora 31',
'fedora/30' => 'Fedora 30',
'fedora/29' => 'Fedora 29',
];
$subs = [
'remi',
'test',
'php56',
];
$archs = [
'i386',
'x86_64',
];
$mirrors = [
'http://remi.conetix.com.au/',
'http://mirrors.neterra.net/remi/',
'http://remi.schlundtech.de/',
'http://mirror.cedia.org.ec/remi/',
'http://ftp.arnes.si/mirrors/remi/',
'http://mirrors.thzhost.com/remi/',
'http://fr2.rpmfind.net/linux/remi/',
'http://mirrors.netix.net/remi/',
'http://remi.mirrors.cu.be/',
'http://mirror.neolabs.kz/remi/',
'https://remi.mirror.ate.info/',
'https://mirrors.tuna.tsinghua.edu.cn/remi/',
'https://mirror.23m.com/remi/',
'https://mirror.oxilion.nl/remi/',
'https://remi.mirror.wearetriple.com/',
'https://mirrors.uni-ruse.bg/remi/',
'https://remi.mirror.karneval.cz/',
'https://mirror.netsite.dk/remi/',
'http://mirror.team-cymru.com/remi/',
'http://mirrors.ukfast.co.uk/sites/remi/',
'https://mirror.netweaver.uk/remi/',
'http://ftp.riken.jp/Linux/remi/',
'https://mir01.syntis.net/remirepo/',
'http://mirrors.bytes.ua/remi/',
'http://mirror.hoster.kz/remi/',
'http://remirepo.reloumirrors.net/',
'https://mirror.pit.teraswitch.com/remi/',
'http://remi.mirror.liteserver.nl/',
'https://mirror.marwan.ma/remi/',
'https://remi.mirror.digitalpacific.com.au/',
'http://merlin.fit.vutbr.cz/mirrors/remi/',
'https://mirrors.ptisp.pt/remi/',
'https://mirrors.chroot.ro/remi/',
'https://mirrors.upr.edu/remi/',
'http://mirror.digitalnova.at/remi/',
'https://mirror.dk.team.blue/remi/',
'https://mirror.dogado.de/remi/',
'https://mirror.docker.ru/remi/',
'https://repo.extreme-ix.org/remi/',
'https://mirror.mangohost.net/remi/',
'https://bd.mirror.vanehost.com/Remi/',
'https://repo1.vetta.net.nz/remi/',
'https://cdn.centos.no/remi/',
'https://mirror.centos.no/remi/',
'https://muug.ca/mirror/remi/',
'https://mirror.netzwerge.de/remi/',
];
$testing = [
'https://pit1.mirror.jurassicinnovations.com/remi/',
'https://mirror.raiolanetworks.com/remi/',
'http://repo1.ash.innoscale.net/remi/',
];
$disabled = [
'https://remi.mivzakim.net/', // 2024-04-03
'https://mirror.usi.edu/pub/remi/', // 2024-04-03
'http://mirror.awanti.com/remi/', // 2024-03-20
'http://mirror.xeonbd.com/remi/',
'https://mirror.telkomuniversity.ac.id/remi/',
'http://mirror.uta.edu.ec/remi/',
'http://repo1.dal.innoscale.net/remi/',
'http://repo1.sea.innoscale.net/remi/',
'http://mirror.yer.az/remi/',
];
$deprecated = [
'https://remi.srv.magticom.ge/',
'https://mirror.sjc02.svwh.net/remi/',
'http://mirror.upb.edu.co/remi/',
'http://mirror.veriteknik.net.tr/remi/',
'http://remi.mirrors.arminco.com/',
'http://mirror.reconn.ru/remi/',
'https://mirror.serverion.com/remi/',
'http://mirror.innosol.asia/remi/',
'http://mirror.nsw.coloau.com.au/remi/',
'http://mirror.bebout.net/remi/',
'http://mirrors.mediatemple.net/remi/',
'http://remi.xpg.com.br/',
'http://ap.stykers.moe/remi/',
'http://mirrors.mivocloud.com/remi/',
'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) {
$ctx = stream_context_create([
'http' => [
'timeout' => 4,
]
]);
$txt = @file_get_contents($uri . '/repodata/repomd.xml', false, $ctx);
if (!$txt) {
return ERR_OFFLINE;
}
$xml = @simplexml_load_string($txt);
if ($xml && $xml->revision>100000) {
return intval($xml->revision);
}
return ERR_CONTENT;
}
if (isset($_GET['mirror']) && isset($repos[$_GET['mirror']])) {
$path = $_GET['mirror'];
} else {
$path = 'enterprise/8';
}
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);
$mirrors = array_merge($mirrors, $testing);
if ($ref) {
if (!$cli) echo "
\n";
if (isset($_SERVER['argv'][1])) {
$tocheck = [];
foreach ($mirrors as $mirror) {
if (preg_match('|'.$_SERVER['argv'][1].'|', $mirror)) {
$tocheck[] = $mirror;
}
}
} else {
$tocheck = $mirrors;
}
printf(($cli ? "Check %d mirror(s) of %s (%s)\n" : "%s - %s
\n"), count($tocheck), $name, date('r', $ref));
foreach ($tocheck as $mirror) {
if ($_SERVER['argc']>1 && !strpos($mirror, $_SERVER['argv'][1])) {
continue;
}
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 ($loc == ERR_OFFLINE) {
printf("%50.50s : ** Unreachable **\n", $mirror);
} else if ($loc == ERR_CONTENT) {
printf("%50.50s : ** Corrupted **\n", $mirror);
} else if ($ref == $loc) {
printf("%50.50s : Ok\n", $mirror);
exit(0);
} else if ($loc) {
printf("%50.50s : %s\n", $mirror, date('r', $loc));
} else {
printf("%50.50s : N/A\n", $mirror);
}
exit(1);
}
continue;
}
flush();
$host = parse_url($mirror, PHP_URL_HOST);
//printf("- %s ", $mirror, $host);
$loc = getRepoTime($mirror.$full);
if ($loc == ERR_OFFLINE) {
printf("
- %s Unreachable
\n", $mirror, $mirror);
} else if ($loc == ERR_CONTENT) {
printf("- %s Corrupted
\n", $mirror, $mirror);
} else 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);
$ok=0;
while (count($pids)) {
if (posix_isatty(STDOUT)) {
printf("Wait %d\r", count($pids));
}
$pid = pcntl_wait($status);
if ($pid<0) {
die("Cound not wait\n");
exit (1);
} else {
if (!pcntl_wexitstatus($status)) $ok++;
unset($pids[$pid]);
}
}
if ($nb) printf("%d mirrors checked, %d OK.\n", $nb, $ok);
} else {
echo "
\n";
}
} else {
printf("
%s - not found
\n", $name);
}
if (!$cli) {
?>