Skip to content

Commit 17357e4

Browse files
committed
Update public facing pages
1 parent b477bf6 commit 17357e4

13 files changed

Lines changed: 49 additions & 47 deletions

File tree

include/branch-overrides.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
return [
44
/* 3.0 is here because version_compare() can't handle the only version in
55
* $OLDRELEASES, and it saves another special case in
6-
* get_branch_security_eol_date(). */
6+
* Branches::getBranchSecurityEOLDate(). */
77
'3.0' => [
88
'security' => '2000-10-20',
99
],

include/branches.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ function get_branch_release_date($branch): ?DateTime
338338
return isset($initial['date']) ? new DateTime($initial['date']) : null;
339339
}
340340

341-
#[Deprecated('Use Branches::getBranchSupportState')]
341+
#[Deprecated('Use Branches::getBranchSupportStatus')]
342342
function get_branch_support_state($branch) {
343343
$initial = get_branch_release_date($branch);
344344
$bug = get_branch_bug_eol_date($branch);

include/gpg-keys.inc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
use phpweb\Releases\Branches;
44

5-
require __DIR__ . '/branches.inc';
6-
75
// GPG keys used for signing releases.
86

97
function gpg_key_get(string $rm): ?string {

public/eol.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<?php
2+
3+
use phpweb\Releases\Branches;
4+
25
$_SERVER['BASE_PAGE'] = 'eol.php';
36

47
require_once __DIR__ . '/../include/prepend.inc';
5-
require_once __DIR__ . '/../include/branches.inc';
68

79
// Notes for specific branches can be added here, and will appear in the table.
810
$BRANCH_NOTES = [
@@ -46,9 +48,9 @@
4648
</tr>
4749
</thead>
4850
<tbody>
49-
<?php foreach (get_eol_branches() as $major => $branches): ?>
51+
<?php foreach (Branches::eol() as $major => $branches): ?>
5052
<?php foreach ($branches as $branch => $detail): ?>
51-
<?php $eolDate = get_branch_security_eol_date($branch) ?>
53+
<?php $eolDate = Branches::getBranchSecurityEOLDate($branch) ?>
5254
<?php $eolPeriod = format_interval($eolDate, new DateTime('now')) ?>
5355
<tr>
5456
<td><?php echo htmlspecialchars($branch); ?></td>

public/images/supported-versions.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
2+
3+
use phpweb\Releases\Branches;
4+
25
include_once __DIR__ . '/../include/prepend.inc';
3-
include_once __DIR__ . '/../include/branches.inc';
4-
require_once __DIR__ . '/../include/prepend.inc';
5-
require_once __DIR__ . '/../include/branches.inc';
66

77
// Sizing constants.
88
$margin_left = 80;
@@ -17,9 +17,9 @@ function branches_to_show() {
1717
$branches = [];
1818

1919
// Flatten out the majors.
20-
foreach (get_all_branches() as $major_branches) {
20+
foreach (Branches::all() as $major_branches) {
2121
foreach ($major_branches as $branch => $version) {
22-
if (version_compare($branch, '5.3', 'ge') && get_branch_security_eol_date($branch) > min_date()) {
22+
if (version_compare($branch, '5.3', 'ge') && Branches::getBranchSecurityEOLDate($branch) > min_date()) {
2323
$branches[$branch] = $version;
2424
}
2525
}
@@ -123,7 +123,7 @@ function date_horiz_coord(DateTime $date) {
123123
<!-- Branch labels -->
124124
<g class="branch-labels">
125125
<?php foreach ($branches as $branch => $version): ?>
126-
<g class="<?php echo get_branch_support_state($branch) ?>">
126+
<g class="<?php echo Branches::getBranchSupportStatus($branch) ?>">
127127
<rect x="0" y="<?php echo $version['top'] ?>" width="<?php echo 0.5 * $margin_left ?>" height="<?php echo $branch_height ?>" />
128128
<text x="<?php echo 0.25 * $margin_left ?>" y="<?php echo $version['top'] + (0.5 * $branch_height) ?>">
129129
<?php echo htmlspecialchars($branch) ?>
@@ -136,9 +136,9 @@ function date_horiz_coord(DateTime $date) {
136136
<g class="branches">
137137
<?php foreach ($branches as $branch => $version): ?>
138138
<?php
139-
$x_release = date_horiz_coord(get_branch_release_date($branch));
140-
$x_bug = date_horiz_coord(get_branch_bug_eol_date($branch));
141-
$x_eol = date_horiz_coord(get_branch_security_eol_date($branch));
139+
$x_release = date_horiz_coord(Branches::getBranchReleaseDate($branch));
140+
$x_bug = date_horiz_coord(Branches::getBranchBugsEOLDate($branch));
141+
$x_eol = date_horiz_coord(Branches::getBranchSecurityEOLDate($branch));
142142
?>
143143
<rect class="stable" x="<?php echo $x_release ?>" y="<?php echo $version['top'] ?>" width="<?php echo $x_bug - $x_release ?>" height="<?php echo $branch_height ?>" />
144144
<rect class="security" x="<?php echo $x_bug ?>" y="<?php echo $version['top'] ?>" width="<?php echo $x_eol - $x_bug ?>" height="<?php echo $branch_height ?>" />

public/index.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
use phpweb\News\NewsHandler;
4+
use phpweb\Releases\Branches;
45

56
(function ($uri): void {
67
// Special redirect cases not able to be captured in error.php
@@ -51,9 +52,7 @@
5152

5253
$_SERVER['BASE_PAGE'] = 'index.php';
5354
require_once __DIR__ . '/../include/prepend.inc';
54-
require_once __DIR__ . '/../include/branches.inc';
5555
require_once __DIR__ . '/../include/pregen-confs.inc';
56-
require_once __DIR__ . '/../include/version.inc';
5756

5857
mirror_setcookie("LAST_NEWS", $_SERVER["REQUEST_TIME"], 60 * 60 * 24 * 365);
5958

@@ -92,7 +91,7 @@
9291
EOF;
9392

9493
$intro .= "<ul class='hero__versions'>\n";
95-
$active_branches = get_active_branches();
94+
$active_branches = Branches::active();
9695
krsort($active_branches);
9796
foreach ($active_branches as $major => $releases) {
9897
krsort($releases);

public/releases/active.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22

33
use phpweb\Releases\Branches;
44

5-
use phpweb\ProjectGlobals;
6-
75
$_SERVER['BASE_PAGE'] = 'releases/active.php';
86

97
require_once __DIR__ . '/../../include/prepend.inc';
10-
require_once ProjectGlobals::getPublicRoot(). '/include/branches.inc';
118

129
header('Content-Type: application/json; charset=UTF-8');
1310

14-
echo json_encode(get_active_branches());
11+
echo json_encode(Branches::active());

public/releases/branches.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
<?php
22

3+
use phpweb\Releases\Branches;
4+
35
include_once __DIR__ . '/../include/prepend.inc';
4-
include_once __DIR__ . '/../include/branches.inc';
5-
require_once __DIR__ . '/../../include/prepend.inc';
6-
require_once __DIR__ . '/../../include/branches.inc';
76

87
header('Content-Type: application/json; charset=UTF-8');
98

@@ -12,15 +11,15 @@ function formatDate($date = null) {
1211
}
1312

1413
$current = [];
15-
foreach (get_all_branches() as $major => $releases) {
14+
foreach (Branches::all() as $major => $releases) {
1615
foreach ($releases as $branch => $release) {
1716
$current[$branch] = [
1817
'branch' => $branch,
1918
'latest' => ($release['version'] ?? null),
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)),
19+
'state' => Branches::getBranchSupportStatus($branch),
20+
'initial_release' => formatDate(Branches::getBranchReleaseDate($branch)),
21+
'active_support_end' => formatDate(Branches::getBranchBugsEOLDate($branch)),
22+
'security_support_end' => formatDate(Branches::getBranchSecurityEOLDate($branch)),
2423
];
2524
}
2625
}

public/releases/feed.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
<?php
22

3+
use phpweb\Releases\Branches;
4+
35
header("Content-Type: application/atom+xml");
46

57
require __DIR__ . "/../../include/version.inc";
68

9+
$RELEASES = Branches::getReleaseData();
10+
711
echo <<<XML
812
<?xml version="1.0" encoding="UTF-8"?>
913
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:php="http://php.net/ns/releases">

public/releases/index.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
<?php
22

3+
use phpweb\Releases\Branches;
4+
35
$_SERVER['BASE_PAGE'] = 'releases/index.php';
46
require_once __DIR__ . '/../../include/prepend.inc';
57
require_once __DIR__ . "/../../include/branches.inc";
68

9+
$RELEASES = Branches::getReleaseData();
10+
$OLDRELEASES = Branches::getOldReleaseData();
11+
712
if (isset($_GET["serialize"]) || isset($_GET["json"])) {
813
$RELEASES = $RELEASES + $OLDRELEASES;
914

1015
$machineReadable = [];
1116

1217
$supportedVersions = [];
13-
foreach (get_active_branches(false) as $major => $releases) {
18+
foreach (Branches::active(false) as $major => $releases) {
1419
$supportedVersions[$major] = array_keys($releases);
1520
}
1621

0 commit comments

Comments
 (0)