Skip to content

Commit 72ba36c

Browse files
authored
Deprecate release/states.php in favor of release/branches.php (#1249)
1 parent 098f637 commit 72ba36c

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

releases/branches.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
include_once __DIR__ . '/../include/prepend.inc';
4+
include_once __DIR__ . '/../include/branches.inc';
5+
6+
header('Content-Type: application/json; charset=UTF-8');
7+
8+
function formatDate($date = null) {
9+
return $date !== null ? $date->format('c') : null;
10+
}
11+
12+
$current = [];
13+
foreach (get_all_branches() as $major => $releases) {
14+
foreach ($releases as $branch => $release) {
15+
$current[$branch] = [
16+
'branch' => $branch,
17+
'latest' => ($release['version'] ?? null),
18+
'state' => get_branch_support_state($branch),
19+
'initial_release' => formatDate(get_branch_release_date($branch)),
20+
'active_support_end' => formatDate(get_branch_bug_eol_date($branch)),
21+
'security_support_end' => formatDate(get_branch_security_eol_date($branch)),
22+
];
23+
}
24+
}
25+
26+
// Sorting should already be correct based on return of get_all_branches(),
27+
// but enforce it here anyway, just to be nice.
28+
usort($current, fn($a, $b) => version_compare($b['branch'], $a['branch']));
29+
30+
echo json_encode($current);

releases/states.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<?php
2+
# This API is deprecated as of 2025-04-01.
3+
# Please use /releases/branches.php instead.
4+
# This API *may* be removed at an indeterminate point in the future.
25

36
$_SERVER['BASE_PAGE'] = 'releases/active.php';
47

0 commit comments

Comments
 (0)