[web-php] master: Fix empty cache-buster timestamp on assets

From: Date: Mon, 16 Nov 2026 17:55:40 +0000
Subject: [web-php] master: Fix empty cache-buster timestamp on assets
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-34187@lists.php.net to get a copy of this message
Author: Jordi Kroon (jordikroon) Committer: Derick Rethans (derickr) Date: 2026-11-16T17:55:37Z Commit: https://github.com/php/web-php/commit/abe5d3bf4dbe8913f894d906be17bcc1bf8dba43 Raw diff: https://github.com/php/web-php/commit/abe5d3bf4dbe8913f894d906be17bcc1bf8dba43.diff Fix empty cache-buster timestamp on assets Changed paths: M include/footer.inc M include/header.inc Diff: diff --git a/include/footer.inc b/include/footer.inc index 7baef52188..c488a5ab96 100644 --- a/include/footer.inc +++ b/include/footer.inc @@ -1,3 +1,8 @@ +<?php + +use phpweb\ProjectGlobals; + +?> </section><!-- layout-content --> <?php if (!empty($config['spanning-content'])) { @@ -80,14 +85,14 @@ if (($config['footer'] ?? true) !== false) { <?php $jsfiles = ["ext/jquery-3.6.0.min.js", "ext/FuzzySearch.min.js", "ext/mousetrap.min.js", "ext/jquery.scrollTo.min.js", "search.js", "common.js"]; foreach ($jsfiles as $filename) { - $path = dirname(__DIR__) . '/js/' . $filename; + $path = ProjectGlobals::getPublicRoot() . '/js/' . $filename; echo '<script src="/cached.php?t=' . @filemtime($path) . '&amp;f=/js/' . $filename . '"></script>' . "\n"; } ?> <?php $jsfiles = ["interactive-examples.js"]; foreach ($jsfiles as $filename) { - $path = dirname(__DIR__) . '/js/' . $filename; + $path = ProjectGlobals::getPublicRoot() . '/js/' . $filename; echo '<script type="module" src="/cached.php?t=' . @filemtime($path) . '&amp;f=/js/' . $filename . '"></script>' . "\n"; } ?> diff --git a/include/header.inc b/include/header.inc index 92abb26c70..c634ebd945 100644 --- a/include/header.inc +++ b/include/header.inc @@ -29,14 +29,14 @@ foreach($css_files as $filename) { if ($filename[0] !== '/') { $filename = "/styles/$filename"; } - $path = dirname(__DIR__) . $filename; + $path = ProjectGlobals::getPublicRoot() . $filename; $CSS[$filename] = @filemtime($path); } $JS = []; if (isset($config["js_files"])) { foreach($config['js_files'] as $filename) { - $path = dirname(__DIR__) . '/' . $filename; + $path = ProjectGlobals::getPublicRoot() . '/' . $filename; $JS[$filename] = @filemtime($path); } }

« previous php.webmaster (#34187) next »