4 ini_set("display_errors", 0);
5 ini_set("log_errors", 1);
9 use http\Client\Request
;
18 while (!feof(STDIN
)) {
19 if (strlen($line = rtrim(fgets(STDIN
)))) {
20 if (list($pkg, $ver, $url) = explode("\t", $line)) {
21 $url = new Url($url, null, 0);
22 $skp = sprintf("%s/../build/%s-%s.skip", __DIR__
, $pkg, $ver);
23 $tgz = sprintf("%s/../build/%s-%s.tgz", __DIR__
, $pkg, $ver);
24 $ext = sprintf("%s/../public/phars/%s/%s-%s.ext.phar", __DIR__
, $pkg, $pkg, $ver);
28 } elseif (is_file($tgz) ||
is_file($ext)) {
29 printf("%s\t%s\t%s\n", $pkg, $ver, $tgz);
31 $client->enqueue(new Request("GET", $url), function($res) use($tgz, $pkg, $ver) {
32 $res->getBody()->toStream(fopen($tgz, "w"));
33 printf("%s\t%s\t%s\n", $pkg, $ver, $tgz);
41 while (count($client)) {
44 } catch (Exception
$e) {
45 error_log($e->getMessage());