View Issue Details

IDProjectCategoryView StatusLast Update
0001829Composrcore_themeingpublic2020-03-20 23:14
ReporterChris GrahamAssigned ToChris Graham 
SeverityFeature-request 
Status resolvedResolutionfixed 
Product Version 
Fixed in Version 
Summary0001829: Allow coding up of template dependencies
DescriptionIf you include one template in another via Tempcode include, or in LESS, then if the included file changes, Composr does not know to recompile the referenced file. Create some kind of system for coding up dependencies. Possibly via _config.php
TagsRoadmap: v11 partial implementation
Time estimation (hours)2
Sponsorship open

Activities

Salman

2015-03-13 14:59

reporter   ~0002634

Last edited: 2015-03-13 14:59

View 2 revisions

Making it automated would be cool.. e.g., cache a list of dependencies on compilation of a template and check all of them for modifications when the template is called. That's one more cache to deal with though lol.

Chris Graham

2015-03-13 15:11

administrator   ~0002635

Would be cool, but how do we do it for LESS? Either we'd need to hook into the lib, do our own parsing, or a regexp hack. And then, that's just for one possible inclusion method. Too much work ;). Better just to KISS and solve it with 95% okayness in much less time.

Chris Graham

2015-03-13 20:55

administrator   ~0002636

A nicer compromise might be to autodetect INCLUDE syntax, and also have wider flexibility via autodetecting any substrings like...

dep:custom.less

Could be encapsulated using whatever native comments, e.g.
/*dep:custom.less*/
{$,dep:FORM_STANDARD_END.tpl}

Chris Graham

2015-03-21 22:13

administrator   ~0002649

Done a very basic implementation for programmers, will leave this issue open in case we want to do the more sophisticated implementation.

Chris Graham

2018-02-02 03:28

administrator   ~0005421

Due to the nature of v11 JS, I have hard-coded some automatic decaching for global.js dependencies.

Chris Graham

2018-08-09 00:55

administrator   ~0005789

I made these notes on a plane, without having an Internet connection (so I could not compare to what else is written in this issue)...

New function, can_use_cache($cache_type, $file_path, $cache_path) -- implements smart_decaching (if enabled), and checks of various cache/keep_cache/cache_*/keep_cache_* parameters, and $SITE_INFO['dependency__' / dependencies_are_good stuff (recursively)
Rename disable_smart_decaching to smart_decaching, and don't have enabled by default (due to the performance hit)
Update the documentation about smart_decaching to make it clear it is not on by default, although it can be enabled via the keep_smart_decaching option
New keep_cache_off_for parameter. Any cacheable asset matching that regexp will not be cached. Implemented within can_use_cache function. Documented alongside documentation about smart_decaching
New automatic dependency detection support:
 When Tempcode is parsed with the INCLUDE directive, update a .dat file, e.g. global.css.tcp.dat
 Emptying the template cache (in any way) should delete the .dat files
 can_use_cache function will use this data, recursively
 Document alongside documentation about smart_decaching

Chris Graham

2020-03-20 23:14

administrator   ~0006477

This is all massive overkill for a relatively rare situation.

All we need is a simple keep_cache_avoid_for URL parameter that takes a regexp of what templates (etc) to temporarily not enable caching on.
Then the developer can debug using that, and when done, empty the template cache.

Meanwhile, the ability to hard-code dependencies is useful, so I've simply documented the simple implementation I've already done.
Implementing auto-detection for that would just be bloat, too much core complexity.

Issue History

Date Modified Username Field Change
2018-02-02 03:13 Chris Graham Description Updated View Revisions
2018-02-02 03:28 Chris Graham Note Added: 0005421
2018-08-09 00:55 Chris Graham Note Added: 0005789
2019-06-27 19:05 Chris Graham Tag Attached: Roadmap: v11 partial implementation
2020-03-07 21:19 Chris Graham Assigned To => Chris Graham
2020-03-07 21:19 Chris Graham Status non-assigned => assigned
2020-03-20 23:14 Chris Graham Status assigned => resolved
2020-03-20 23:14 Chris Graham Resolution open => fixed
2020-03-20 23:14 Chris Graham Note Added: 0006477