handle opcache as zend_extension
[m6w6/pecl-ci] / php-version-url-dist.php
1 #!/usr/bin/env php
2 <?php
3
4
5 $versions = @json_decode(stream_get_contents(STDIN), 1);
6 $mirror = getenv("PHP_MIRROR");
7
8
9
10
11
12
13 $by_minor = array();
14 # build the tree of latest versions per minor
15 if (!empty($versions) && !isset($versions["error"])) {
16 foreach (array_keys((array) $versions) as $release) {
17 list($major, $minor, $patch) = explode(".", $release);
18 if (isset($by_minor["$major.$minor"])) {
19 if (version_compare($release, $by_minor["$major.$minor"], "<")) {
20 continue;
21 }
22 }
23 $by_minor["$major.$minor"] = $release;
24 }
25 }
26
27 foreach ($by_minor as $v => $r) {
28 $compress = array("gz" => "z", "bz2" => "j", "xz" => "J");
29 $filename = $versions[$r]["source"][0]["filename"];
30 printf("%s\t%s\tcurl -sSL %s%s | tar x%s\n", $v, $r, $mirror,
31 $filename,
32 $compress[pathinfo($filename, PATHINFO_EXTENSION)]
33 );
34 }