xref: /web-php/include/version.inc (revision 94869b48)
1<?php
2/* The format is:
3 * array(
4 *     "major release number" => array(
5 *         "release" => array(
6 *             "source/windows" => array(
7 *                 "filename" => "filename.tar.bz2",
8 *                 "name"     => "package name",
9 *                 "sha256"   => "shasum -256",
10 *                 "date"     => "this files release date",
11 *                 "note"     => "this file was updated 29feb due to broken phar files..",
12 *             ),
13 *             "announcement" => "bool, release announcement exists in releases/?",
14 *         ),
15 *     ),
16 * );
17 */
18$RELEASES = (function () {
19    $data = [];
20
21    /* PHP 8.4 Release */
22    $data['8.4'] = [
23        'version' => '8.4.2',
24        'date' => '19 Dec 2024',
25        'tags' => [], // Set to ['security'] for security releases.
26        'sha256' => [
27            'tar.gz' => '5d3cf82a7f4cafdcfc4f3d98f3e3ee81077ae57c709a5613cbff5834d78a7747',
28            'tar.bz2' => 'ef4fe9921b885ce3b047792ab60260eaf657e22812be511d19d0e45edf984783',
29            'tar.xz' => '92636453210f7f2174d6ee6df17a5811368f556a6c2c2cbcf019321e36456e01',
30        ]
31    ];
32
33    /* PHP 8.3 Release */
34    $data['8.3'] = [
35        'version' => '8.3.15',
36        'date' => '19 Dec 2024',
37        'tags' => [], // Set to ['security'] for security releases.
38        'sha256' => [
39            'tar.gz' => '67073c3c9c56c86461e0715d9e1806af5ddffe8e6e2eb9781f7923bbb5bd67fa',
40            'tar.bz2' => 'b1675a4ff730b5811b8e6a7687488c42e835e156a99776aa3e6f017abda3be98',
41            'tar.xz' => '3df5d45637283f759eef8fc3ce03de829ded3e200c3da278936a684955d2f94f',
42        ]
43    ];
44
45    /* PHP 8.2 Release */
46    $data['8.2'] = [
47        'version' => '8.2.27',
48        'date' => '19 Dec 2024',
49        'tags' => [], // Set to ['security'] for security releases.
50        'sha256' => [
51            'tar.gz' => '179cc901760d478ffd545d10702ebc2a1270d8c13471bdda729d20055140809a',
52            'tar.bz2' => '6e57dbaf769a7f3deb4f0f48b8c535e671cc0a18022ed7f6ff23b50e941d4b60',
53            'tar.xz' => '3eec91294d8c09b3df80b39ec36d574ed9b05de4c8afcb25fa215d48f9ecbc6b',
54        ]
55    ];
56
57    /* PHP 8.1 Release */
58    $data['8.1'] = [
59        'version' => '8.1.31',
60        'date' => '21 Nov 2024',
61        'tags' => ['security'], // Set to ['security'] for security releases.
62        'sha256' => [
63            'tar.gz' => '618923b407c4575bfee085f00c4aaa16a5cc86d4b1eb893c0f352d61541bbfb1',
64            'tar.bz2' => '0b39828b345151caf1b795d9f4b923c9887231776c33076dfc9d90a44390d0dc',
65            'tar.xz' => 'c4f244d46ba51c72f7d13d4f66ce6a9e9a8d6b669c51be35e01765ba58e7afca',
66        ]
67    ];
68
69    $ret = [];
70    foreach ($data as $release) {
71        $version = $release['version'];
72        [$major] = explode('.', $version, 2);
73
74        $info = [
75            'announcement' => $release['announcement'] ?? true,
76            'tags' => $release['tags'],
77            'date' => $release['date'],
78            'source' => [],
79        ];
80        foreach ($release['sha256'] as $format => $hash) {
81            $info['source'][] = [
82                'filename' => "php-{$version}.{$format}",
83                'name' => "PHP {$version} ({$format})",
84                'sha256' => $hash,
85                'date' => $release['date'],
86            ];
87        }
88        $ret[$major][$version] = $info;
89    }
90    return $ret;
91})();
92
93// Get latest release version and info.
94function release_get_latest() {
95    global $RELEASES;
96
97    $version = '0.0.0';
98    $current = null;
99    foreach ($RELEASES as $versions) {
100        foreach ($versions as $ver => $info) {
101            if (version_compare($ver, $version) > 0) {
102                $version = $ver;
103                $current = $info;
104            }
105        }
106    }
107
108    return [$version, $current];
109}
110