diff options
author | Dmitry Patsura <[email protected]> | 2019-06-07 17:51:24 +0300 |
---|---|---|
committer | Dmitry Patsura <[email protected]> | 2019-06-07 17:51:24 +0300 |
commit | b71ec58e30da602a3d3f04feb00f9dc4f806245b (patch) | |
tree | 4989ff040db11c6d324c0068fde4973c7737d929 /src | |
parent | e0e1dbdced1255001d13cd940d636607c1c9139f (diff) |
Fix(rr): Workaround for Symfony < 4.1.x
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/rr | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -226,7 +226,7 @@ class RRHelper curl_setopt($curlResource, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curlResource, CURLOPT_FILE, $zipFile); curl_setopt($curlResource, CURLOPT_PROGRESSFUNCTION, - function ($resource, $download_size, $downloaded, $upload_size, $uploaded) use ($progressBar) { + function ($resource, $download_size, $downloaded, $upload_size, $uploaded) use (&$progressBar, $output) { if ($download_size == 0) { return; } @@ -235,8 +235,15 @@ class RRHelper $progressBar->start(); } + if ($progressBar->getMaxSteps() != $download_size) { + /** + * Workaround for symfony < 4.1.x, for example PHP 7.0 will use 3.x + * feature #26449 Make ProgressBar::setMaxSteps public (ostrolucky) + */ + $progressBar = new ProgressBar($output, $download_size); + } + $progressBar->setFormat('[%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% ' . intval($download_size / 1024) . 'KB'); - $progressBar->setMaxSteps($download_size); $progressBar->setProgress($downloaded); }); curl_setopt($curlResource, CURLOPT_NOPROGRESS, false); // needed to make progress function work |