xref: /web-php/include/version.inc (revision 4d5868de)
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.3 Release */
22    $data['8.3'] = [
23        'version' => '8.3.13',
24        'date' => '24 Oct 2024',
25        'tags' => [], // Set to ['security'] for security releases.
26        'sha256' => [
27            'tar.gz' => 'ffe34317d2688ed3161809c90ca4135c84ebfdfd12a46880a264d7d1e1d7739a',
28            'tar.bz2' => 'c7791c82e1a554ccaf84a40ba71cc1417ba9af67fb5b39780837fd7c7eb6f124',
29            'tar.xz' => '89adb978cca209124fe53fd6327bc4966ca21213a7fa2e9504f854e340873018',
30        ]
31    ];
32
33    /* PHP 8.2 Release */
34    $data['8.2'] = [
35        'version' => '8.2.25',
36        'date' => '24 Oct 2024',
37        'tags' => [], // Set to ['security'] for security releases.
38        'sha256' => [
39            'tar.gz' => '7fe7ba6e3e66cd0e61cfa95341e6aefc8790030a7867333f54aef5fb78aad18b',
40            'tar.bz2' => '07b41c5e96c60c096510e45f02f818414d11bdd0d5da1b6840ddba2ba7289401',
41            'tar.xz' => '330b54876ea1d05ade12ee9726167332058bccd58dffa1d4e12117f6b4f616b9',
42        ]
43    ];
44
45    /* PHP 8.1 Release */
46    $data['8.1'] = [
47        'version' => '8.1.30',
48        'date' => '26 Sep 2024',
49        'tags' => ['security'], // Set to ['security'] for security releases.
50        'sha256' => [
51            'tar.gz' => '80addd302b7e9708e0d106779c3827520eccaf14af1149174b51da33d63e6af7',
52            'tar.bz2' => 'cb1625e5ac49b91037477e3e7767bb0624343971aeb992f4791b618af571d23e',
53            'tar.xz' => 'f24a6007f0b25a53cb7fbaee69c85017e0345b62089c2425a0afb7e177192ed1',
54        ]
55    ];
56
57    $ret = [];
58    foreach ($data as $release) {
59        $version = $release['version'];
60        [$major] = explode('.', $version, 2);
61
62        $info = [
63            'announcement' => $release['announcement'] ?? true,
64            'tags' => $release['tags'],
65            'date' => $release['date'],
66            'source' => [],
67        ];
68        foreach ($release['sha256'] as $format => $hash) {
69            $info['source'][] = [
70                'filename' => "php-{$version}.{$format}",
71                'name' => "PHP {$version} ({$format})",
72                'sha256' => $hash,
73                'date' => $release['date'],
74            ];
75        }
76        $ret[$major][$version] = $info;
77    }
78    return $ret;
79})();
80
81// Get latest release version and info.
82function release_get_latest() {
83    global $RELEASES;
84
85    $version = '0.0.0';
86    $current = null;
87    foreach ($RELEASES as $versions) {
88        foreach ($versions as $ver => $info) {
89            if (version_compare($ver, $version) > 0) {
90                $version = $ver;
91                $current = $info;
92            }
93        }
94    }
95
96    return [$version, $current];
97}
98