View previous topic :: View next topic |
Author |
Message |
adn Smarty Regular
Joined: 31 May 2011 Posts: 91
|
Posted: Fri May 29, 2015 2:11 pm Post subject: Problem to clean up compiled tpl with 3.1.24 |
|
|
Hello,
I switched yesterday from 3.1.21 ro 3.1.24 and it seems I am no more able to delete my compiled templates. I do it manually (
Something has changed or a bug? _________________ http://www.letsGarden.info |
|
Back to top |
|
adn Smarty Regular
Joined: 31 May 2011 Posts: 91
|
Posted: Fri May 29, 2015 3:09 pm Post subject: |
|
|
I did other tests and the clean up of the cache is ok but not for compiled templates.
Neither the clear all nor the one by id work
Code: | $smarty->clearCompiledTemplate($id);
$smarty->clearCompiledTemplate(); |
My config is this one
Code: | $smarty->setCaching(Smarty::CACHING_LIFETIME_CURRENT);
$smarty->setCompileCheck(FALSE);
$smarty->setDebugging(FALSE);
$smarty->setMergeCompiledIncludes(TRUE);
$smarty->setUseSubDirs(TRUE); |
All of this was ok in 3.1.21
I did a rm -rf * in the compiled template cache before my tests
Bug? _________________ http://www.letsGarden.info |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Sat May 30, 2015 8:37 am Post subject: |
|
|
I can't reproduce your problem. It does work perfectly here.
Any errors in the error logs? |
|
Back to top |
|
adn Smarty Regular
Joined: 31 May 2011 Posts: 91
|
Posted: Sat May 30, 2015 5:01 pm Post subject: |
|
|
Thanks !
I did others tests and when I do a clearCompiledTemplate() I can see that the compiled templates directory is completely emptied. So it does work.
I will do some other tests ... Maybe some delay with the opcache _________________ http://www.letsGarden.info |
|
Back to top |
|
adn Smarty Regular
Joined: 31 May 2011 Posts: 91
|
Posted: Sun May 31, 2015 7:35 pm Post subject: |
|
|
U.Tews,
I did several tests today.
And in fact $smarty->clearCompiledTemplate() works fine, the whole compiled template directory is emptied
But for me $smarty->clearCompiledTemplate('myTemplate.tpl') doesn't work. I'm obliged all the time to delete everything.
How can I see that the compiled template is well deleted? (I don't really understand the tree in the cache
I have no error in php log
What could be wrong between the two versions ?
Note: I modified several templates which doesn't work anymore with the new version, specially templates with some parts in nocache. It seems that there are modifications on the management of variables in cache or not. _________________ http://www.letsGarden.info |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Mon Jun 01, 2015 2:59 am Post subject: |
|
|
Compiled templates and cached templates are two different things.
Also, check if you are not supplying compile_id when assembling templates - if you do, you must supply same compile_id to Smarty::clearCompliedTemplate() call. |
|
Back to top |
|
adn Smarty Regular
Joined: 31 May 2011 Posts: 91
|
Posted: Mon Jun 01, 2015 8:31 pm Post subject: |
|
|
AnrDaemon wrote: | Also, check if you are not supplying compile_id when assembling templates - if you do, you must supply same compile_id to Smarty::clearCompliedTemplate() call. |
YES I just added the compile_id the same day of the switch ! Now I understand the new tree I can see in the compiled templates cache
Once again thanks !!
This story of compile_id is quite strange, why it is not integrated in arguments of the clear and the creation api. A complete example in the doc could be helpfull.
I put "page.tpl" as a compile_id for the root of my template tree. Is it a good id ? It seems that page_tpl is generated in the cache. Maybe "page" without the extension is better. _________________ http://www.letsGarden.info |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Mon Jun 01, 2015 11:57 pm Post subject: |
|
|
Why did you add a compile_id at all?
A compile_id normally makes only sense when you use different pre- or/and post-filters for the same template to keep the resulting compiled templates separated. |
|
Back to top |
|
adn Smarty Regular
Joined: 31 May 2011 Posts: 91
|
Posted: Tue Jun 02, 2015 7:17 am Post subject: |
|
|
I added the compile_id to manage "device serving" or "Dynamic serving"
https://developers.google.com/webmasters/mobile-sites/mobile-seo/configurations/dynamic-serving?hl=fr
The root of my templates depends of the detected device.
My templates starts with this
Code: | {extends file=$rootTemplate} |
At creation time, I detect the device and my manager assign $rootTemplate and define also the compile_id with the same value.
I have 2 root templates, one for desktops and one for mobiles
My root templates contains the page structure and the templates only the content.
So the compile_id is used to separate 2 cache trees generated dynamically _________________ http://www.letsGarden.info |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Tue Jun 02, 2015 9:31 am Post subject: |
|
|
You don't need compile_id in this case.
You _ONLY_ need compile_id, if you build different templates from the same file. |
|
Back to top |
|
adn Smarty Regular
Joined: 31 May 2011 Posts: 91
|
Posted: Tue Jun 02, 2015 1:44 pm Post subject: |
|
|
I did my first integration of this mechanism without the compile_id and it doesn't work. I got only one version, the mobile one even if I change the root template.
After that I saw the note here
http://www.smarty.net/docs/en/language.function.extends.tpl
Then I added the compile_id and everything became ok.
So now I don't understand. I can redo my test _________________ http://www.letsGarden.info |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Tue Jun 02, 2015 3:15 pm Post subject: |
|
|
No, you are right.
I forgot that {extend} is a compile-time instruction. Though, there's ideas to redo this part of the functionality.
But for now, what you are doing, indeed, requires different compile_id. |
|
Back to top |
|
adn Smarty Regular
Joined: 31 May 2011 Posts: 91
|
Posted: Tue Jun 02, 2015 3:45 pm Post subject: |
|
|
OK great !
Yes the story of the compile_id is not well explained and can certainly be enhanced.
But really even if it is quite complicated, it is a great capability
Before knowing that I had duplicated all my templates to manage the two devices !! _________________ http://www.letsGarden.info |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Wed Jun 03, 2015 2:15 am Post subject: |
|
|
Read carefully the INHERITANCE_RELEASE_NOTES when you are using variable template names.
I'm currently experimenting with runtime inheritance. It will remove all existing restrictions and current problems when it is done.... |
|
Back to top |
|
adn Smarty Regular
Joined: 31 May 2011 Posts: 91
|
Posted: Wed Jun 03, 2015 5:32 pm Post subject: |
|
|
Yes I will have to read it because I thought that my problem was fixed but no... Certainly something I still do not understand
I do now
Code: | $smarty->compile_id = 'page.tpl';
$smarty->clearCompiledTemplate($id); |
_________________ http://www.letsGarden.info |
|
Back to top |
|
|