- $this->info("Fetching remote source %s ... ", $source);
- if (!$remote = fopen($source, "r")) {
+ $context = stream_context_create([],["notification" => function($notification, $severity, $message, $code, $bytes_cur, $bytes_max) {
+ switch ($notification) {
+ case STREAM_NOTIFY_CONNECT:
+ $this->debug("\n");
+ break;
+ case STREAM_NOTIFY_PROGRESS:
+ if ($bytes_max) {
+ $bytes_pct = $bytes_cur/$bytes_max;
+ $this->debug("\r %3d%% [%s>%s] ",
+ $bytes_pct*100,
+ str_repeat("=", round(70*$bytes_pct)),
+ str_repeat(" ", round(70*(1-$bytes_pct)))
+ );
+ }
+ break;
+ case STREAM_NOTIFY_COMPLETED:
+ /* this is not generated, why? */
+ break;
+ }
+ }]);
+ if (!$remote = fopen($source, "r", false, $context)) {