@@ -19,8 +19,8 @@ class PrestissimoFileFetcher extends FileFetcher {
1919 */
2020 protected $ config ;
2121
22- public function __construct (\Composer \Util \RemoteFilesystem $ remoteFilesystem , $ source , array $ filenames = [], IOInterface $ io , Config $ config ) {
23- parent ::__construct ($ remoteFilesystem , $ source , $ filenames , $ io );
22+ public function __construct (\Composer \Util \RemoteFilesystem $ remoteFilesystem , $ source , array $ filenames = [], IOInterface $ io , $ progress = TRUE , Config $ config ) {
23+ parent ::__construct ($ remoteFilesystem , $ source , $ filenames , $ io, $ progress );
2424 $ this ->config = $ config ;
2525 }
2626
@@ -37,10 +37,16 @@ protected function fetchWithPrestissimo($version, $destination) {
3737 array_walk ($ this ->filenames , function ($ filename ) use ($ version , $ destination , &$ requests ) {
3838 $ url = $ this ->getUri ($ filename , $ version );
3939 $ this ->fs ->ensureDirectoryExists ($ destination . '/ ' . dirname ($ filename ));
40- $ this ->io ->write ("Going to download the file $ filename " );
41- $ this ->io ->write (" from: $ url " );
42- $ requests [] = new CopyRequest ($ url , $ destination . '/ ' . $ filename , false , $ this ->io , $ this ->config );
43- $ this ->io ->write (" to: $ destination/ $ filename " );
40+ if ($ this ->progress ) {
41+ $ this ->io ->writeError (" - <info> $ filename</info> (<comment> $ url</comment>): " , FALSE );
42+ $ requests [] = new CopyRequest ($ url , $ destination . '/ ' . $ filename , false , $ this ->io , $ this ->config );
43+ // Used to put a new line because the remote file system does not put
44+ // one.
45+ $ this ->io ->writeError ('' );
46+ }
47+ else {
48+ $ requests [] = new CopyRequest ($ url , $ destination . '/ ' . $ filename , false , $ this ->io , $ this ->config );
49+ }
4450 });
4551
4652 $ successCnt = $ failureCnt = 0 ;
@@ -54,8 +60,10 @@ protected function fetchWithPrestissimo($version, $destination) {
5460 $ result = $ multi ->getFinishedResults ();
5561 $ successCnt += $ result ['successCnt ' ];
5662 $ failureCnt += $ result ['failureCnt ' ];
57- foreach ($ result ['urls ' ] as $ url ) {
58- $ this ->io ->writeError (" <comment> $ successCnt/ $ totalCnt</comment>: \t$ url " , true , \Composer \IO \IOInterface::VERBOSE );
63+ if ($ this ->progress ) {
64+ foreach ($ result ['urls ' ] as $ url ) {
65+ $ this ->io ->writeError (" <comment> $ successCnt/ $ totalCnt</comment>: \t$ url " , true , \Composer \IO \IOInterface::VERBOSE );
66+ }
5967 }
6068 } while ($ multi ->remain ());
6169 }
0 commit comments