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

who is calling Smarty_Internal_Template::mustCompile()?

 
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 -> Smarty 3
View previous topic :: View next topic  
Author Message
SlowFox
Smarty Regular


Joined: 02 Oct 2006
Posts: 55

PostPosted: Sun Oct 16, 2011 2:08 pm    Post subject: who is calling Smarty_Internal_Template::mustCompile()? Reply with quote

After switching to the trunk (due to some custom resource issues recently discussed) my templates are not compiled any more after saving changes to them (and as far as I can see, I implemented the populate() method of my custom resource correctly).

Investigating this lead me to Smarty_Internal_Template::mustCompile() which seems to be the one and only place where template and compilation dates are compared. Problem is: this method is never called (I can even put a "die;" statement at its very beginning without any effect).

In my "old" Smarty Version (3.0.7), mustCompile() was called (at least) from SmartyInternalTemplate::getCompiledTemplate() and fromm SmartyInternalTemplate::renderTemplate(), but neither of these two functions does exist anymore. With my limited knowledge, I have found no other call - where SHOULD it be?
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Sun Oct 16, 2011 2:48 pm    Post subject: Reply with quote

mustCompile() is in Smarty 3.1 no longer called internally.

The check is now done in decodeProperties(). It loops over all file dependencies and compares the timestamps to determine the $is_valid status.

It looks like that your resouce does not populate the correct timestamp.
Back to top
View user's profile Send private message
SlowFox
Smarty Regular


Joined: 02 Oct 2006
Posts: 55

PostPosted: Sun Oct 16, 2011 3:47 pm    Post subject: Reply with quote

U.Tews wrote:
The check is now done in decodeProperties(). It loops over all file dependencies

Thank you - this was enough information to solve the problem.

Quote:
It looks like that your resouce does not populate the correct timestamp.

No, actually the piece of the code was copied 1:1 from the Smarty resource handler.

The bug was hiding in buildUniqueResourceName(): I use this function to map identifiers to complete file paths (and to generate a unique id from that path), but I did ONLY expect identifiers as an argument. However the compiled templates identify with their full path and pass this path to buildUniqueResourceName (instead of the identifier). My function did not expect this and for the sake of speed just terminated (which prohibited ->populate() of being called at all)...

(I don't know whether it is worth noting this fact somewhere in the documentation)
Back to top
View user's profile Send private message
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 -> Smarty 3 All times are GMT
Page 1 of 1

 
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