1
0
Fork 0

Limit progress output, mitigates #283

pull/308/head
Jordi Boggiano 2012-02-17 11:53:38 +01:00
parent 844c43092f
commit 8b7a64ab28
1 changed files with 4 additions and 1 deletions

View File

@ -27,6 +27,7 @@ class RemoteFilesystem
private $fileName; private $fileName;
private $content; private $content;
private $progess; private $progess;
private $lastProgress;
/** /**
* Constructor. * Constructor.
@ -87,6 +88,7 @@ class RemoteFilesystem
$this->fileUrl = $fileUrl; $this->fileUrl = $fileUrl;
$this->fileName = $fileName; $this->fileName = $fileName;
$this->progress = $progess; $this->progress = $progess;
$this->lastProgress = null;
// add authorization in context // add authorization in context
$options = array(); $options = array();
@ -182,7 +184,8 @@ class RemoteFilesystem
$progression = round($bytesTransferred / $this->bytesMax * 100); $progression = round($bytesTransferred / $this->bytesMax * 100);
} }
if (0 === $progression % 5) { if ((0 === $progression % 5) && $progression !== $this->lastProgress) {
$this->lastProgress = $progression;
$this->io->overwrite(" Downloading: <comment>$progression%</comment>", false); $this->io->overwrite(" Downloading: <comment>$progression%</comment>", false);
} }
} }