From 06cc674f09b83ab52f64f5c4a8a9d05600ee6dc5 Mon Sep 17 00:00:00 2001 From: kc9uhi Date: Mon, 2 Mar 2026 17:45:36 -0700 Subject: [PATCH] fix cache buster usage of DOCUMENT_ROOT when installed in a subfolder --- application/libraries/Paths.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/application/libraries/Paths.php b/application/libraries/Paths.php index 24dedda76..1b86af470 100644 --- a/application/libraries/Paths.php +++ b/application/libraries/Paths.php @@ -42,12 +42,13 @@ class Paths '/assets/json/datatables_languages/en-US.json', ]; - $fullpath = $_SERVER['DOCUMENT_ROOT'] . $filepath; - + $CI = & get_instance(); + $fullpath = empty($CI->config->item('directory')) ? $_SERVER['DOCUMENT_ROOT'] . $filepath : $_SERVER['DOCUMENT_ROOT'] . '/' . $CI->config->item('directory') . $filepath; + // We comment out this line because latest teste at LA8AJA's XAMPP setup showed that it works even without it // So we will keep it simple and just use the $filepath as is, since it seems to work fine on both Linux and Windows setups // $fullpath = rtrim($_SERVER['DOCUMENT_ROOT'], '/\\') . str_replace('/', DIRECTORY_SEPARATOR, $filepath); - + if (file_exists($fullpath)) { return base_url($filepath) . '?v=' . filemtime($fullpath); } else {