xref: /web-php/releases/states.php (revision 59c070f5)
1<?php
2
3$_SERVER['BASE_PAGE'] = 'releases/active.php';
4
5include_once __DIR__ . '/../include/prepend.inc';
6include_once $_SERVER['DOCUMENT_ROOT'] . '/include/branches.inc';
7
8header('Content-Type: application/json; charset=UTF-8');
9
10$states = [];
11
12function formatDate($date = null) {
13    return $date !== null ? $date->format('c') : null;
14}
15
16foreach (get_all_branches() as $major => $releases) {
17    $states[$major] = [];
18    foreach ($releases as $branch => $release) {
19        $states[$major][$branch] = [
20            'state' => get_branch_support_state($branch),
21            'initial_release' => formatDate(get_branch_release_date($branch)),
22            'active_support_end' => formatDate(get_branch_bug_eol_date($branch)),
23            'security_support_end' => formatDate(get_branch_security_eol_date($branch)),
24        ];
25    }
26    krsort($states[$major]);
27}
28
29krsort($states);
30
31echo json_encode($states);
32