Author: Derick Rethans (derickr)
Date: 2026-08-14T13:10:50+01:00
Commit: Fix 'supported-versions.php' page, and caching in some other pages too · php/web-php@26b50b7 · GitHub
Raw diff: https://github.com/php/web-php/commit/26b50b74acf74e10646804f2e31866c199eb9bfd.diff
Fix 'supported-versions.php' page, and caching in some other pages too
Changed paths:
A public/include/pregen-confs.inc
A public/include/pregen-news.inc
D include/pregen-confs.inc
D include/pregen-news.inc
M phpstan.neon.dist
M public/images/supported-versions.php
M public/releases/active.php
M public/releases/index.php
M public/supported-versions.php
Diff:
diff --git a/phpstan.neon.dist b/phpstan.neon.dist
index ee0bff472b..7dd8e0ad29 100644
--- a/phpstan.neon.dist
+++ b/phpstan.neon.dist
@@ -17,5 +17,5 @@ parameters:
- var/ (?)
- public/manual/en
- include/releases.inc
- - include/pregen-news.inc
- - include/pregen-confs.inc
+ - public/include/pregen-news.inc
+ - public/include/pregen-confs.inc
diff --git a/public/images/supported-versions.php b/public/images/supported-versions.php
index 80434bbb8c..5e16e15d73 100644
--- a/public/images/supported-versions.php
+++ b/public/images/supported-versions.php
@@ -1,6 +1,8 @@
<?php
-require_once __DIR__ . '/../include/prepend.inc';
-require_once __DIR__ . '/../include/branches.inc';
+use phpweb\ProjectGlobals;
+
+require_once __DIR__ . '/../../include/prepend.inc';
+require_once ProjectGlobals::getProjectRoot(). '/include/branches.inc';
// Sizing constants.
$margin_left = 80;
@@ -55,6 +57,7 @@ function date_horiz_coord(DateTime $date) {
if (!isset($non_standalone)) {
header('Content-Type: image/svg+xml');
+ header('Cache-Control: public, max-age=10800'); // 3 hours
echo '<?xml version="1.0"?>';
}
diff --git a/include/pregen-confs.inc b/public/include/pregen-confs.inc
similarity index 100%
rename from include/pregen-confs.inc
rename to public/include/pregen-confs.inc
diff --git a/include/pregen-news.inc b/public/include/pregen-news.inc
similarity index 100%
rename from include/pregen-news.inc
rename to public/include/pregen-news.inc
diff --git a/public/releases/active.php b/public/releases/active.php
index 5aa8360c1a..d9ac8fb0d0 100644
--- a/public/releases/active.php
+++ b/public/releases/active.php
@@ -8,5 +8,6 @@
require_once ProjectGlobals::getProjectRoot(). '/include/branches.inc';
header('Content-Type: application/json; charset=UTF-8');
+header('Cache-Control: public, max-age=900');
echo json_encode(get_active_branches());
diff --git a/public/releases/index.php b/public/releases/index.php
index 7a259cb250..e87e49df4c 100644
--- a/public/releases/index.php
+++ b/public/releases/index.php
@@ -1,8 +1,10 @@
<?php
+use phpweb\ProjectGlobals;
+
$_SERVER['BASE_PAGE'] = 'releases/index.php';
require_once __DIR__ . '/../../include/prepend.inc';
-require_once __DIR__ . "/../../include/branches.inc";
+require_once ProjectGlobals::getProjectRoot(). '/include/branches.inc';
if (isset($_GET["serialize"]) || isset($_GET["json"])) {
$RELEASES = $RELEASES + $OLDRELEASES;
diff --git a/public/supported-versions.php b/public/supported-versions.php
index c7d98b6097..8912bc7623 100644
--- a/public/supported-versions.php
+++ b/public/supported-versions.php
@@ -1,10 +1,19 @@
<?php
+
+use phpweb\ProjectGlobals;
+
$_SERVER['BASE_PAGE'] = 'supported-versions.php';
require_once __DIR__ . '/../include/prepend.inc';
-require_once __DIR__ . '/../include/branches.inc';
+require_once ProjectGlobals::getProjectRoot(). '/include/branches.inc';
-site_header('Supported Versions', ['css' => ['supported-versions.css']]);
+site_header(
+ 'Supported Versions',
+ [
+ 'css' => ['supported-versions.css'],
+ 'cache_control' => 3 * 60 * 60, // 3 hours
+ ]
+);
// Version notes: if you need to make a note about a version having an unusual
// support lifetime, add it under a heading with an anchor, and add the anchor