mirror of
https://github.com/unraid/webgui.git
synced 2026-01-24 10:28:39 -06:00
Make wget percentage detection more robust
This commit is contained in:
@@ -238,9 +238,9 @@ function download($url, $name, &$error, $write=true) {
|
||||
if ($file = popen("wget --compression=auto --no-cache --progress=dot --retry-connrefused --prefer-family=IPv4 --timeout=10 --tries=$tries --waitretry=$tries -O $name $url 2>&1", 'r')) {
|
||||
if ($write) write("plugin: downloading: $plg ...\r");
|
||||
$level = -1;
|
||||
while (($line = fgets($file)) !== false) {
|
||||
if (preg_match('/\d+%/', $line, $matches)) {
|
||||
$percentage = substr($matches[0],0,-1);
|
||||
while (($line = fgets($file)) !== false) {
|
||||
if (preg_match('/ \d+% /', $line, $matches)) {
|
||||
$percentage = substr(trim($matches[0]),0,-1);
|
||||
if ($percentage > $level) {
|
||||
if ($write) write("plugin: downloading: $plg ... $percentage%\r");
|
||||
$level = $percentage;
|
||||
|
||||
Reference in New Issue
Block a user