Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Problem to clean up compiled tpl with 3.1.24
Goto page 1, 2  Next
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
adn
Smarty Regular


Joined: 31 May 2011
Posts: 91

PostPosted: Fri May 29, 2015 2:11 pm    Post subject: Problem to clean up compiled tpl with 3.1.24 Reply with quote

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 Surprised(

Something has changed or a bug?
_________________
http://www.letsGarden.info
Back to top
View user's profile Send private message Visit poster's website
adn
Smarty Regular


Joined: 31 May 2011
Posts: 91

PostPosted: Fri May 29, 2015 3:09 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Sat May 30, 2015 8:37 am    Post subject: Reply with quote

I can't reproduce your problem. It does work perfectly here.
Any errors in the error logs?
Back to top
View user's profile Send private message
adn
Smarty Regular


Joined: 31 May 2011
Posts: 91

PostPosted: Sat May 30, 2015 5:01 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
adn
Smarty Regular


Joined: 31 May 2011
Posts: 91

PostPosted: Sun May 31, 2015 7:35 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Mon Jun 01, 2015 2:59 am    Post subject: Reply with quote

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
View user's profile Send private message
adn
Smarty Regular


Joined: 31 May 2011
Posts: 91

PostPosted: Mon Jun 01, 2015 8:31 pm    Post subject: Reply with quote

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 Very Happy

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
View user's profile Send private message Visit poster's website
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Mon Jun 01, 2015 11:57 pm    Post subject: Reply with quote

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
View user's profile Send private message
adn
Smarty Regular


Joined: 31 May 2011
Posts: 91

PostPosted: Tue Jun 02, 2015 7:17 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Tue Jun 02, 2015 9:31 am    Post subject: Reply with quote

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
View user's profile Send private message
adn
Smarty Regular


Joined: 31 May 2011
Posts: 91

PostPosted: Tue Jun 02, 2015 1:44 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Tue Jun 02, 2015 3:15 pm    Post subject: Reply with quote

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
View user's profile Send private message
adn
Smarty Regular


Joined: 31 May 2011
Posts: 91

PostPosted: Tue Jun 02, 2015 3:45 pm    Post subject: Reply with quote

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 Very Happy

Before knowing that I had duplicated all my templates to manage the two devices !!
_________________
http://www.letsGarden.info
Back to top
View user's profile Send private message Visit poster's website
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Wed Jun 03, 2015 2:15 am    Post subject: Reply with quote

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
View user's profile Send private message
adn
Smarty Regular


Joined: 31 May 2011
Posts: 91

PostPosted: Wed Jun 03, 2015 5:32 pm    Post subject: Reply with quote

Yes I will have to read it because I thought that my problem was fixed but no... Certainly something I still do not understand Sad

I do now

Code:
$smarty->compile_id = 'page.tpl';
$smarty->clearCompiledTemplate($id);

_________________
http://www.letsGarden.info
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP