Revision f444c396
Added by Erik Fonnesbeck over 14 years ago
etc/inc/pfsense-utils.inc | ||
---|---|---|
1460 | 1460 |
global $fout, $file_size, $downloaded, $sendto, $static_status, $static_output, $lastseen; |
1461 | 1461 |
$length = strlen($string); |
1462 | 1462 |
$downloaded += intval($length); |
1463 |
$downloadProgress = round(100 * (1 - $downloaded / $file_size), 0); |
|
1464 |
$downloadProgress = 100 - $downloadProgress; |
|
1463 |
if($file_size > 0) { |
|
1464 |
$downloadProgress = round(100 * (1 - $downloaded / $file_size), 0); |
|
1465 |
$downloadProgress = 100 - $downloadProgress; |
|
1466 |
} else |
|
1467 |
$downloadProgress = 0; |
|
1465 | 1468 |
if($lastseen <> $downloadProgress and $downloadProgress < 101) { |
1466 | 1469 |
if($sendto == "status") { |
1467 | 1470 |
$tostatus = $static_status . $downloadProgress . "%"; |
Also available in: Unified diff
Prevent division by zero if the file size is zero.