[pLog-svn] {dynamic} tags and plugins

Jon Daley plogworld at jon.limedaley.com
Thu May 3 14:15:49 EDT 2007


 	Right, that is what Oscar and I are discussing - that the plugin 
object is not initialized when the document is cached, so the {dynamic} 
tags don't work with plugins.  (see the second paragraph of my original 
email).
 	But, I agree with Oscar, that it would be nice to have even less 
overhead when pages are cached.  It will probably be tricky, since we will 
want the $authuser to not be cached, so some stuff does have to be loaded.

On Thu, 3 May 2007, Ahmad Saleh wrote:

> Hi
> I think the problem here is not in {dynamic} or in {include}, I think the
> plugin object doesn't reach to the template because it's cached so if you
> can assign plugin object to smarty before you check if the page is cached it
> will work.
>
> regards,
>   Ahmad
>
> On 5/3/07, Jon Daley <plogworld at jon.limedaley.com> wrote:
>>
>>         Yes, I agree, except that the plugins like blogstatistics,
>> authentication and google haven't worked since we added the template
>> cache, so we did lose useful functionality.
>>         Authentication has now been implemented in the core, but I like
>> both the blogstatistics and google plugins, and wish there was a way to
>> make it work.
>>         Using the {insert} tag would be an acceptable solution to me, and
>> it might be possible to get that to work both to optimize the load for
>> cached pages, and only incur the overhead was processing the extra
>> inserted templates.
>> 
>> 
>> On Wed, 2 May 2007, Oscar Renalias wrote:
>> 
>> > Well yeah it's not that getting plugins to run within cached pages
>> > was technically impossible... With a little bit of code here and
>> > there everything's possible :) But we never really had a need to get
>> > plugins to run in a cached pages, or else we're kind of defeating the
>> > point of caching. If there's something that we're not able to cache,
>> > we're still incurring in some extra overhead, as Smarty needs to
>> > process and render a small bit of a template.
>> >
>> > We can of course make the changes to get around this limitation but I
>> > see two issues:
>> >
>> > 1) we wouldn't be able to do it before 1.3, because we shouldn't
>> > break/change the standard behaviour of plugins and the whole plugin
>> > framework this late into the 1.2.x branch.
>> >
>> > 2) and most important, I have been thinking about ways to optimize
>> > cached pages even more. Right now we still need to load the whole
>> > framework in order to display a page that has already been generated
>> > and for which we don't need any extra classes or processing: we just
>> > need to load the cached version from disk and push it to the client.
>> > Ideally all we would need to do is come up with a way to quickly
>> > identify if a page is cached (maybe we can use a hash of the URL?)
>> > and quickly send it back to the client, but I need to have a closer
>> > look at the code and see if this is even feasible to do...
>> >
>> > Number 2 obviously means that plugins wouldn't work in cached pages
>> > and this time there wouldn't even a workaround available.
>> >
>> > On 2 May 2007, at 17:26, Jon Daley wrote:
>> >
>> >> http://bugs.lifetype.net/view.php?id=293
>> >>
>> >> We have talked about this a long time ago, and came up with the 
>> >> conclusion that plugins can't work inside the {dynamic} tag. It 
>> >> turns out that isn't really true.
>> >>
>> >> The problem is in class/view/blogview.class.php, where a bunch of 
>> >> template objects are only included if the template isn't cached. 
>> >> If you move the plugin for loop (or the $now) code, those variables 
>> >> are available inside a {dynamic} tag.
>> >>
>> >> However, since that increases the RAM used for cached pages, we 
>> >> don't want to just put everything outside the if(!cached) block.
>> >>
>> >> I was wondering about either letting the plugins decide themselves 
>> >> if they should be loaded or not, or check the template to see if 
>> >> there is a {dynamic} tag or have an administration preference that 
>> >> says "Allow plugins inside dynamic tags.  I am not sure what would 
>> >> be the easiest or best.  Any thoughts?
>> >>
>> >> I see now that for the plugins the objects are already loaded even 
>> >> in a cached view (I think) but the call to PluginManager->getPlugins 
>> >> calls register() for each plugin in the non-cached view as opposed 
>> >> to the cached view.  Maybe that overhead isn't that much?


More information about the pLog-svn mailing list