Fix public asset cache-busting to execute filemtime() not output PHP code

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-10-30 23:15:36 +00:00
parent 0fef8539f4
commit 62e138eee0

View File

@@ -398,7 +398,8 @@ abstract class Rsx_Bundle_Abstract
// Add public directory CSS (with filemtime cache-busting)
$public_css = $compiled['public_css'] ?? [];
foreach ($public_css as $asset) {
$html[] = '<link rel="stylesheet" href="' . htmlspecialchars($asset['url']) . '?v=<?php echo filemtime(\'' . addslashes($asset['full_path']) . '\'); ?>">';
$mtime = file_exists($asset['full_path']) ? filemtime($asset['full_path']) : time();
$html[] = '<link rel="stylesheet" href="' . htmlspecialchars($asset['url']) . '?v=' . $mtime . '">';
}
// Add JS: jQuery first, then others
@@ -415,7 +416,8 @@ abstract class Rsx_Bundle_Abstract
// Add public directory JS (with filemtime cache-busting and defer)
$public_js = $compiled['public_js'] ?? [];
foreach ($public_js as $asset) {
$html[] = '<script src="' . htmlspecialchars($asset['url']) . '?v=<?php echo filemtime(\'' . addslashes($asset['full_path']) . '\'); ?>" defer></script>';
$mtime = file_exists($asset['full_path']) ? filemtime($asset['full_path']) : time();
$html[] = '<script src="' . htmlspecialchars($asset['url']) . '?v=' . $mtime . '" defer></script>';
}
// Add CSS bundles