summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Titov <[email protected]>2019-06-07 18:27:30 +0300
committerGitHub <[email protected]>2019-06-07 18:27:30 +0300
commit00abe6b1f26e9def03e7f1ac1b536ec9433370a9 (patch)
tree475792ac21c7e74a485a5d6a64cde5722a7576c8 /src
parent0b7a6aee403d213f80ef27c11cecb7b54ff9a5d3 (diff)
parentf00608935f3d2576bf3edc50d3eb303ce2cd66ea (diff)
Merge pull request #158 from ovr/ci-improve
Feature(CI): Lint php code + exec rr get-binary
Diffstat (limited to 'src')
-rw-r--r--src/bin/rr13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/bin/rr b/src/bin/rr
index a3c613b1..2b392467 100644
--- a/src/bin/rr
+++ b/src/bin/rr
@@ -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