From 8b7a64ab28cf81cbcb79ba9c8238c73de064a99d Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 17 Feb 2012 11:53:38 +0100 Subject: [PATCH] Limit progress output, mitigates #283 --- src/Composer/Util/RemoteFilesystem.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Composer/Util/RemoteFilesystem.php b/src/Composer/Util/RemoteFilesystem.php index 0ce391ace..0f245b81b 100644 --- a/src/Composer/Util/RemoteFilesystem.php +++ b/src/Composer/Util/RemoteFilesystem.php @@ -27,6 +27,7 @@ class RemoteFilesystem private $fileName; private $content; private $progess; + private $lastProgress; /** * Constructor. @@ -87,6 +88,7 @@ class RemoteFilesystem $this->fileUrl = $fileUrl; $this->fileName = $fileName; $this->progress = $progess; + $this->lastProgress = null; // add authorization in context $options = array(); @@ -182,7 +184,8 @@ class RemoteFilesystem $progression = round($bytesTransferred / $this->bytesMax * 100); } - if (0 === $progression % 5) { + if ((0 === $progression % 5) && $progression !== $this->lastProgress) { + $this->lastProgress = $progression; $this->io->overwrite(" Downloading: $progression%", false); } }