Skip to content

Commit c5b4a53

Browse files
committed
Update supported-versions with the new code.
1 parent dcab901 commit c5b4a53

1 file changed

Lines changed: 35 additions & 31 deletions

File tree

supported-versions.php

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<?php
2+
3+
use phpweb\Releases\VersionData;
4+
25
$_SERVER['BASE_PAGE'] = 'supported-versions.php';
36

47
include_once __DIR__ . '/include/prepend.inc';
@@ -15,6 +18,10 @@
1518
'8.3' => 'https://www.php.net/manual/migration83.php',
1619
'8.2' => 'https://www.php.net/manual/migration82.php',
1720
];
21+
22+
$supportedVersions = VersionData::getSupportedVersions(includeRecentEOL: false);
23+
uksort($supportedVersions, version_compare(...));
24+
1825
?>
1926

2027
<h1>Supported Versions</h1>
@@ -51,37 +58,34 @@
5158
</tr>
5259
</thead>
5360
<tbody>
54-
<?php foreach (get_active_branches(false) as $major => $releases): ?>
55-
<?php ksort($releases) ?>
56-
<?php foreach ($releases as $branch => $release): ?>
57-
<?php
58-
$state = get_branch_support_state($branch);
59-
$initial = get_branch_release_date($branch);
60-
$until = get_branch_bug_eol_date($branch);
61-
$eol = get_branch_security_eol_date($branch);
62-
$now = new DateTime('now');
63-
?>
64-
<tr class="<?php echo $state ?>">
65-
<td>
66-
<a href="/downloads.php?version=<?php echo htmlspecialchars($branch) ?>"><?php echo htmlspecialchars($branch) ?></a>
67-
</td>
68-
<td><?php echo htmlspecialchars($initial->format('j M Y')) ?></td>
69-
<td class="collapse-phone"><em><?php echo htmlspecialchars(format_interval($initial, $now)) ?></em></td>
70-
<td><?php echo htmlspecialchars($until->format('j M Y')) ?></td>
71-
<td class="collapse-phone"><em><?php echo htmlspecialchars(format_interval($until, $now)) ?></em></td>
72-
<td><?php echo htmlspecialchars($eol->format('j M Y')) ?></td>
73-
<td class="collapse-phone"><em><?php echo htmlspecialchars(format_interval($eol, $now)) ?></em></td>
74-
<td>
75-
<?php if (isset($VERSION_NOTES[$branch])): ?>
76-
<a href="<?php echo htmlspecialchars($VERSION_NOTES[$branch]) ?>">
77-
Migration guide for PHP <?php echo htmlspecialchars($branch) ?>
78-
</a>
79-
<?php else: ?>
80-
81-
<?php endif; ?>
82-
</td>
83-
</tr>
84-
<?php endforeach ?>
61+
<?php foreach ($supportedVersions as $release): ?>
62+
<?php
63+
$state = $release->supportState->value;
64+
$initial = $release->releaseDate;
65+
$until = $release->bugfixEOL;
66+
$eol = $release->securityEOL;
67+
$now = new DateTime('now');
68+
?>
69+
<tr class="<?php echo $state ?>">
70+
<td>
71+
<a href="<?php echo htmlspecialchars($release->downloadUri) ?>"><?php echo htmlspecialchars($release->label) ?></a>
72+
</td>
73+
<td><?php echo htmlspecialchars($initial->format('j M Y')) ?></td>
74+
<td class="collapse-phone"><em><?php echo htmlspecialchars(format_interval($initial, $now)) ?></em></td>
75+
<td><?php echo htmlspecialchars($until->format('j M Y')) ?></td>
76+
<td class="collapse-phone"><em><?php echo htmlspecialchars(format_interval($until, $now)) ?></em></td>
77+
<td><?php echo htmlspecialchars($eol->format('j M Y')) ?></td>
78+
<td class="collapse-phone"><em><?php echo htmlspecialchars(format_interval($eol, $now)) ?></em></td>
79+
<td>
80+
<?php if (isset($VERSION_NOTES[$release->label])): ?>
81+
<a href="<?php echo htmlspecialchars($VERSION_NOTES[$release->label]) ?>">
82+
Migration guide for PHP <?php echo htmlspecialchars($release->label) ?>
83+
</a>
84+
<?php else: ?>
85+
86+
<?php endif; ?>
87+
</td>
88+
</tr>
8589
<?php endforeach ?>
8690
</tbody>
8791
</table>

0 commit comments

Comments
 (0)