diff options
-rw-r--r-- | .travis.yml | 10 | ||||
-rw-r--r-- | src/bin/rr | 13 |
2 files changed, 16 insertions, 7 deletions
diff --git a/.travis.yml b/.travis.yml index c3ad45b2..24aacbf4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,8 @@ install: - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" - php composer-setup.php - php composer.phar install --no-interaction --prefer-source + - find src/ -name "*.php" -print0 | xargs -0 -n1 -P8 php -l + - chmod +x src/bin/rr && src/bin/rr get-binary script: - go test -race -v -coverprofile=lib.txt -covermode=atomic @@ -40,26 +42,26 @@ jobs: before_install: - sudo add-apt-repository -y ppa:ondrej/php - sudo apt-get update - - sudo apt-get install -y php7.0-cli + - sudo apt-get install -y php7.0-cli php7.0-curl - sudo cp `which php7.0` `which php` - stage: Test env: "PHP=7.1" before_install: - sudo add-apt-repository -y ppa:ondrej/php - sudo apt-get update - - sudo apt-get install -y php7.1-cli + - sudo apt-get install -y php7.1-cli php7.1-curl - sudo cp `which php7.1` `which php` - stage: Test env: "PHP=7.2" before_install: - sudo add-apt-repository -y ppa:ondrej/php - sudo apt-get update - - sudo apt-get install -y php7.2-cli + - sudo apt-get install -y php7.2-cli php7.2-curl - sudo cp `which php7.2` `which php` - stage: Test env: "PHP=7.3" before_install: - sudo add-apt-repository -y ppa:ondrej/php - sudo apt-get update - - sudo apt-get install -y php7.3-cli + - sudo apt-get install -y php7.3-cli php7.3-curl - sudo cp `which php7.3` `which php`
\ No newline at end of file @@ -33,7 +33,7 @@ if (!defined('RR_COMPOSER_INSTALL')) { die(1); } -if (!class_exists('ZipArchive')) { +if (RRHelper::getOSType() !== 'linux' && !class_exists('ZipArchive')) { fwrite(STDERR, 'Extension `php-zip` is required.' . PHP_EOL); die(1); } @@ -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 |