Author: Derick Rethans (derickr)
Date: 2026-07-03T11:02:34+01:00
Commit:
https://github.com/php/web-php/commit/27254253bb5cc64562d23b933dba402856c272a7
Raw diff:
https://github.com/php/web-php/commit/27254253bb5cc64562d23b933dba402856c272a7.diff
Set Cache-Control for ChangeLogs on the application side
Changed paths:
M include/changelogs.inc
M include/header.inc
M include/layout.inc
Diff:
diff --git a/include/changelogs.inc b/include/changelogs.inc
index 75898f3aa1..afbee4a68f 100644
--- a/include/changelogs.inc
+++ b/include/changelogs.inc
@@ -48,6 +48,8 @@ function changelog_header(int $major_version, array
$minor_versions): void {
'current' => 'docs',
'css' => ['changelog.css'],
'layout_span' => 12,
+ 'cache' => true,
+ 'cache_control' => 30 * 60, // 30 minutes
]);
echo "<h1>PHP {$major_version} ChangeLog</h1>\n";
$glue = '';
diff --git a/include/header.inc b/include/header.inc
index 8cbf3221da..3cb6c44db6 100644
--- a/include/header.inc
+++ b/include/header.inc
@@ -49,6 +49,11 @@ if ($config["cache"]) {
}
header("Last-Modified: " . $tsstring);
}
+
+if ($config["cache_control"] && is_numeric($config["cache_control"])) {
+ header("Cache-Control: public, max-age=" . (int)
$config["cache_control"]);
+}
+
if (!isset($config["languages"])) {
$config["languages"] = [];
}
diff --git a/include/layout.inc b/include/layout.inc
index b9cc7c0b63..30550b6a65 100644
--- a/include/layout.inc
+++ b/include/layout.inc
@@ -456,6 +456,7 @@ function site_header(?string $title = NULL, array $config =
[]): void
'classes' => '',
'layout_span' => 9,
"cache" => false,
+ 'cache_control' => false,
"headsup" => "",
'meta_tags' => <<<META
<meta name="Description" content="{$meta_description}" />