Author: Sara Golemon (sgolemon)
Committer: GitHub (web-flow)
Pusher: sgolemon
Date: 2025-03-27T14:04:46-05:00

Commit: 
https://github.com/php/web-php/commit/72ba36cfd72d24123228d4239ada36a3de104f63
Raw diff: 
https://github.com/php/web-php/commit/72ba36cfd72d24123228d4239ada36a3de104f63.diff

Deprecate release/states.php in favor of release/branches.php (#1249)

Changed paths:
  A  releases/branches.php
  M  releases/states.php


Diff:

diff --git a/releases/branches.php b/releases/branches.php
new file mode 100644
index 0000000000..952063c803
--- /dev/null
+++ b/releases/branches.php
@@ -0,0 +1,30 @@
+<?php
+
+include_once __DIR__ . '/../include/prepend.inc';
+include_once __DIR__ . '/../include/branches.inc';
+
+header('Content-Type: application/json; charset=UTF-8');
+
+function formatDate($date = null) {
+    return $date !== null ? $date->format('c') : null;
+}
+
+$current = [];
+foreach (get_all_branches() as $major => $releases) {
+    foreach ($releases as $branch => $release) {
+        $current[$branch] = [
+            'branch' => $branch,
+            'latest' => ($release['version'] ?? null),
+            'state' => get_branch_support_state($branch),
+            'initial_release' => formatDate(get_branch_release_date($branch)),
+            'active_support_end' => 
formatDate(get_branch_bug_eol_date($branch)),
+            'security_support_end' => 
formatDate(get_branch_security_eol_date($branch)),
+        ];
+    }
+}
+
+// Sorting should already be correct based on return of get_all_branches(),
+// but enforce it here anyway, just to be nice.
+usort($current, fn($a, $b) => version_compare($b['branch'], $a['branch']));
+
+echo json_encode($current);
diff --git a/releases/states.php b/releases/states.php
index 435d7dd2db..3622b07399 100644
--- a/releases/states.php
+++ b/releases/states.php
@@ -1,4 +1,7 @@
 <?php
+# This API is deprecated as of 2025-04-01.
+# Please use /releases/branches.php instead.
+# This API *may* be removed at an indeterminate point in the future.
 
 $_SERVER['BASE_PAGE'] = 'releases/active.php';
 

Reply via email to