View Issue Details

IDProjectCategoryView StatusLast Update
0023324mantisbtperformancepublic2018-03-30 05:32
Reportercproensa Assigned Tocproensa  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version2.7.0 
Target Version2.7.0Fixed in Version2.7.0 
Summary0023324: Generated css, js code should be cached by browser
Description

Generated files like:

  • status_config.php
  • javascript_config.php
  • javascript_translations.php

Are currently not cached by clients, increasing load time and server request processing.

Usually, the content of those files is not changed unless there is a change in global configuration, so it's safe to be cached.

TagsNo tags attached.

Relationships

related to 0023310 closedatrol Unused CSS delivered 
related to 0024189 closedcproensa Status color squares become black 

Activities

cproensa

cproensa

2017-09-06 13:09

developer   ~0057629

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

atrol

atrol

2017-09-06 13:24

developer   ~0057631

so it's safe to be cached.

Sure?
The content can be user, project and language dependant

cproensa

cproensa

2017-09-06 13:40

developer   ~0057632

The content can be user, project and language dependant

in the same browser?
maybe driver by logged user

let's see if that can be accounted with some sort of headers

atrol

atrol

2017-09-06 13:54

developer   ~0057633

Not sure we are talking about the same thing.

E.g status_config.php generates CSS code (colors) based on config_get( 'status_enum_string');
You can have different settings for status_enum_string for different projects, so whenever you change current project, the generated CSS code might change.

E.g. javascript_translations.php generates JS code based on current language setting.
You can't use the cached version if you change your language via "My Account" settings.

cproensa

cproensa

2017-09-06 14:29

developer   ~0057634

Last edited: 2017-09-06 17:56

status_config.php

This could be dependant on user, but not on project.
Even if the status colours could be configured at project level, the behaviour won't be correct.
Having different settings for status_enum_string for different projects, would be even more chaotic (think about filters)

javascript_config.php

dependant on user, but current content i think it's not based on project:
print_config_value( 'datetime_picker_format' );. I'd say this it's not a project specific config (or it shouldn't, at least)
print_config_value( 'short_path' );. This should not even be overridable

javascript_translations.php

Dependant on language (not on user directly), but not on poject.

cproensa

cproensa

2017-09-06 14:32

developer   ~0057635

Not sure we are talking about the same thing.

yes, i understand.
I mean: somehow, those dependences can be used as a differentiator for the resource, so every request for the same combination of properties is cached

Related Changesets

MantisBT: master 712edd2d

2017-09-06 08:54

cproensa

Committer: vboctor


Details Diff
Allow caching of generated js/css files

Allow client caching of dynamically generated css and js files.
Default headers disable explicitly caching of application pages, but
these generated files don't change usually between page loads.
By disabling default headers, the cacheability is defined by the server
configuration.

The included resources are referenced by a URL query built with a
parameter that differentiates content that may have changed based on
current user, project, language, etc. This parameter would force a
reload in case the content may be different from the cached version.

Fixes: 0023324
Affected Issues
0023324
mod - core/helper_api.php Diff File
mod - core/html_api.php Diff File
mod - css/status_config.php Diff File
mod - javascript_config.php Diff File
mod - javascript_translations.php Diff File