Support to clear cache only in subtrees when changing TS
Added support to clear cache only in subtrees starting at the actual pid of an template. If you want to use this feature you have to add
$TYPO3_CONF_VARS['BE']['clearCacheSubTreeOnly'] = 1;
Will only work in template mode for the moment. I.e. all other clear_cacheCmd('all') will work as usual.
(issue imported from #M1031)
#2 Updated by Michael Stucki almost 15 years ago
Yes it is a feature. Last week Rupert Germann has had a deeper look at the patch.
As far as I remember him saying the main problem is that this is only implemented in the template module view and nowhere else.
A 2nd problem is the inconsistency which would be introduced with that: Clicking "Clear FE cache" will cause different actions depending on where you clicked that link.
I suggest someone implements this as an extension first and we'll try to bring it back in 3.9.0.
#3 Updated by Peter Russ almost 15 years ago
@k-fish: this was originally added as a feature request.
@stucki: the reason for the "inconsitency" is very simple: if you do a redesign or layout testing for an existing site, EVERY TIME you make a change in TS the COMPLETE cache is deleted AUTOMATICALLY by DEFAULT.
That might be pretty hard for indexed-search. On the other hand when you click manually "Clear FE cache" you should know what you do.
I would recommed to add the feature as it leaves everything unchanged if not activated.
#6 Updated by Rupert Germann almost 15 years ago
you wrote: " EVERY TIME you make a change in TS the COMPLETE cache is deleted AUTOMATICALLY by DEFAULT. ... "
This is only true if you make this changes in the "web/template" module. When saving template records in the "web/list" view this doesn't happen.
didn't know this until now.
But I think tcemain is not the right place to change this.
The command to clear the cache is initiated by this line in: typo3/ext/tstemplate_info/class.tx_tstemplateinfo.php
that's the place where the "tree IDs" should be collected and then added as list to the clear_cacheCmd e.g.:
of course only if "clearCacheSubTreeOnly" is set.
you wrote also "That might be pretty hard for indexed-search...."
The index of the indexed search is not influenced by cleaning the cache. Never.
#7 Updated by Peter Russ almost 15 years ago
The solution provided is optimized for no side effects.
IMHO t3lib_div::testInt($cacheCmd) at t3lib_clearcacheCmd is a bug that prevents the elegant solution that rupi suggested and that was taken into account when providing the solution.
But as this feature was introduced at a time when stucki claimed that there was no feature freeze for 3.8. the intention was to add as "less bugs" as possible with the solution provided.
We could design and test the elegant solution for one of the next releases. But if you have hundreds of pages in cache you might wish to reduce the number of pages deleted from cache when making changes in subtrees of the template.
#8 Updated by Rupert Germann almost 15 years ago
t3lib_div::testInt($cacheCmd) is no bug because t3lib_clearcacheCmd is never called with arrays but for every single command or single page id in the list of commands.
IMO it's a good idea to postpone this feature for TYPO3 3.9.0 (or for a new version of "tstemplate_info")
peter wrote "But if you have hundreds of pages in cache you might wish to reduce the number of pages deleted from cache when making changes in subtrees of the template."
then edit templates in list mode and clear the tree under the changed template with the admin panel.
#9 Updated by Peter Russ almost 15 years ago
@rupi: ref to 2179 you recommened a solution like $tce->clear_cacheCmd("1,2,3,4,5,6,7") but now you are claiming that "t3lib_clearcacheCmd is never called with arrays"?
From my understanding of Typo3 this is an array "1,2,3,4,5,6,7" and
!strcmp($var,intval($var)) will always return false. Am I wrong?
Pls. have a look at the original code:
So the intention was there to support "arrays". BUT testInt delimits the usability. Otherwise the implode in the following exec_DELETEquery would be totaly obsolute. And this would be either poor design or is just a bug.
"then edit templates in list mode and clear the tree under the changed template with the admin panel." : Von hinten durch d' Brust ins Aug'. Oder: warum einfach, wenn's kompliziert auch geht.
IMO we should add this feature "hidden" as this has no (AGAIN NO side effects!) and get information from people using that to improve. I bet there are more features implemented that have more side effects.