diff options
author | Remi Collet <remi@remirepo.net> | 2024-09-24 10:19:42 +0200 |
---|---|---|
committer | Remi Collet <remi@php.net> | 2024-09-24 10:19:42 +0200 |
commit | a03eae77ff86b050ff1e2e0aad3d464cb97e2ae5 (patch) | |
tree | eb18efb6832d01de7fc4b471a303f1a88c7874a6 | |
parent | 3849f521ebf94f3287af201d012539802dae835e (diff) |
count OK mirrors
-rwxr-xr-x | check.php | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -232,12 +232,13 @@ if ($ref) { 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); } - break; + exit(1); } continue; } @@ -259,6 +260,7 @@ if ($ref) { } if ($cli) { $nb=count($pids); + $ok=0; while (count($pids)) { if (posix_isatty(STDOUT)) { printf("Wait %d\r", count($pids)); @@ -268,10 +270,11 @@ if ($ref) { die("Cound not wait\n"); exit (1); } else { + if (!pcntl_wexitstatus($status)) $ok++; unset($pids[$pid]); } } - if ($nb) printf("%d mirrors checked.\n", $nb); + if ($nb) printf("%d mirrors checked, %d OK.\n", $nb, $ok); } else { echo "</ul>\n"; } |