aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorfilip <filip.komar@gmail.com>2021-03-13 12:29:24 +0100
committerfilip <filip.komar@gmail.com>2021-03-13 12:29:24 +0100
commite619e12ce32ebfc1b99e840a1327ebf4c08d82b6 (patch)
treec3e81e45b05d78dbb215c9976fb782ad755a3ee1 /lib
parent3774eb42105b17cda4efa8d3d0710cd817c3bdc0 (diff)
downloadwww-e619e12ce32ebfc1b99e840a1327ebf4c08d82b6.tar
www-e619e12ce32ebfc1b99e840a1327ebf4c08d82b6.tar.gz
www-e619e12ce32ebfc1b99e840a1327ebf4c08d82b6.tar.bz2
www-e619e12ce32ebfc1b99e840a1327ebf4c08d82b6.tar.xz
www-e619e12ce32ebfc1b99e840a1327ebf4c08d82b6.zip
improving the progress output of update mirrors cache script
Diffstat (limited to 'lib')
-rw-r--r--lib/Downloads.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Downloads.php b/lib/Downloads.php
index 9ebeaf1c5..4ca48383f 100644
--- a/lib/Downloads.php
+++ b/lib/Downloads.php
@@ -162,7 +162,11 @@ class Downloads
include_once(realpath(__DIR__) . '/../en/downloads/get/lib.php');
$refresh_country_and_city_arrays = true;
}
+ $num_of_all_mirrs = count($data);
+ $num_of_tested_mirrs = 0;
foreach ($data as $line) {
+ $num_of_tested_mirrs++;
+ $mirrs_processed = sprintf("%.0f %%", $num_of_tested_mirrs / $num_of_all_mirrs * 100);
$line = explode(',', trim($line));
$m = array();
foreach ($line as $val) {
@@ -223,10 +227,10 @@ class Downloads
}
if (false === @file_get_contents($test_file)) {
$num_dn++;
- echo "Down $num_dn (up: $num_up) $test_file \n";
+ echo "Down $num_dn (up: $num_up, $mirrs_processed mirrors tested) $test_file \n";
} else {
$num_up++;
- echo "Up $num_up (down: $num_dn) $test_file \n";
+ echo "Up $num_up (down: $num_dn, $mirrs_processed mirrors tested) $test_file \n";
// $mirrors[$m['country']][] = $item;
$mirrors['_C:' . $m['continent']][] = $item;
}