View Issue Details

IDProjectCategoryView StatusLast Update
0026148mantisbtuipublic2023-10-31 16:32
Reportersyncguru Assigned Tovboctor  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version2.23.0 
Target Version2.26.0Fixed in Version2.26.0 
Summary0026148: Add hash to MantisBT CSS files to force browser cache update
Description

Recent PR made some UI changes but the generated CSS files have the same names as the old ones so the browser rightly ignored downloading the new ones. See attached image for an example of bad CSS that would be fixed by browser cache refresh. We need to update the build process to append the file content hash to the name of the CSS file to address this issue.

TagsNo tags attached.
Attached Files

Activities

polzin

polzin

2019-12-17 17:02

reporter   ~0063292

Last edited: 2019-12-17 17:03

A simple solution should be to add a query parameter to the css link:

core/html_api.php
:: - echo "\t", '<link rel="stylesheet" type="text/css" href="', string_sanitize_url( helper_mantis_url( $p_filename ), true ), '" />', "\n";
:: + echo "\t", '<link rel="stylesheet" type="text/css" href="', string_sanitize_url( helper_mantis_url( $p_filename ), true ),
:: + '?ver=', MANTIS_VERSION , '" />', "\n";

vboctor

vboctor

2021-08-07 21:15

manager   ~0065739

PR: https://github.com/mantisbt/mantisbt/pull/1773

atrol

atrol

2021-10-17 05:46

developer   ~0065924

Reopened as the PR is currently not merged to master or master-2.25

Related Changesets

MantisBT: master 43c5381d

2021-10-28 08:51

vboctor

Committer: dregad


Details Diff
Include cache key when including unversioned css

When including our css files that don't have a version in the name,
include cache key based on Mantis version.

Refactored `html_css_link()` to have cache param.

Fixes 0026148, PR https://github.com/mantisbt/mantisbt/pull/1773
Affected Issues
0026148
mod - core/html_api.php Diff File
mod - core/layout_api.php Diff File