@@ -22,8 +22,8 @@ class PrestissimoFileFetcher extends FileFetcher {
2222 /**
2323 * Constructs this PrestissimoFileFetcher object.
2424 */
25- public function __construct (RemoteFilesystem $ remoteFilesystem , $ source , IOInterface $ io , $ progress = TRUE , Config $ config ) {
26- parent ::__construct ($ remoteFilesystem , $ source , $ io , $ progress );
25+ public function __construct (RemoteFilesystem $ remoteFilesystem , IOInterface $ io , $ progress = TRUE , Config $ config ) {
26+ parent ::__construct ($ remoteFilesystem , $ io , $ progress );
2727 $ this ->config = $ config ;
2828 }
2929
@@ -32,10 +32,9 @@ public function __construct(RemoteFilesystem $remoteFilesystem, $source, IOInter
3232 */
3333 public function fetch ($ version , $ destination , $ override ) {
3434 if (class_exists (CurlMulti::class)) {
35- $ this ->fetchWithPrestissimo ($ version , $ destination , $ override );
36- return ;
35+ return $ this ->fetchWithPrestissimo ($ version , $ destination , $ override );
3736 }
38- parent ::fetch ($ version , $ destination , $ override );
37+ return parent ::fetch ($ version , $ destination , $ override );
3938 }
4039
4140 /**
@@ -57,7 +56,7 @@ protected function fetchWithPrestissimo($version, $destination, $override) {
5756 $ errors = [];
5857 $ totalCnt = count ($ requests );
5958 if ($ totalCnt == 0 ) {
60- return ;
59+ return TRUE ;
6160 }
6261
6362 $ multi = new CurlMulti ();
@@ -70,6 +69,9 @@ protected function fetchWithPrestissimo($version, $destination, $override) {
7069 $ failureCnt += $ result ['failureCnt ' ];
7170 if (isset ($ result ['errors ' ])) {
7271 $ errors += $ result ['errors ' ];
72+ foreach ($ result ['errors ' ] as $ url => $ error ) {
73+ $ this ->io ->writeError (" - Downloading <comment> $ successCnt</comment>/<comment> $ totalCnt</comment>: <info> $ url</info> (<error>failed</error>) " , TRUE );
74+ }
7375 }
7476 if ($ this ->progress ) {
7577 foreach ($ result ['urls ' ] as $ url ) {
@@ -78,10 +80,20 @@ protected function fetchWithPrestissimo($version, $destination, $override) {
7880 }
7981 } while ($ multi ->remain ());
8082
81- $ urls = array_keys ($ errors );
82- if ($ urls ) {
83- throw new \Exception ('Failed to download ' . implode (", " , $ urls ));
83+ if ($ errors ) {
84+ $ this ->addError ('Failed to download: ' . "\r\n" . implode ("\r\n" , array_keys ($ errors )));
85+ $ errors_extra = [];
86+ foreach ($ errors as $ error ) {
87+ if ($ error !== "0: " && !isset ($ errors_extra [$ error ])) {
88+ $ errors_extra [$ error ] = $ error ;
89+ }
90+ }
91+ if ($ errors_extra ) {
92+ $ this ->addError (implode ("\r\n" , $ errors_extra ));
93+ }
94+ return FALSE ;
8495 }
96+ return TRUE ;
8597 }
8698
8799}
0 commit comments