vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Graveyard (https://vborg.vbsupport.ru/forumdisplay.php?f=224)
-   -   Board Optimization - Plugin Based Template Cache (https://vborg.vbsupport.ru/showthread.php?t=121876)

Kihon Kata 12-24-2006 05:07 PM

Hi Orban! Merry Christmas.

Question: Does this hack automatically delete the cached template when the template is changed or updated? Mine is doing something strange. The only way I can view an updated template in the browser is to turn off your cacher, update the template, load the page.

Then I turn the cacher back on.

It seems as if the cache is still there until I turn the cacher off.

LMK what this means.

Thanks!

orban 12-24-2006 08:53 PM

Quote:

Originally Posted by RS_Jelle (Post 1141696)
I've got the same problem ... but I uploaded it to the correct folder, my forums folder. I can't give an url cause it's currently on our test site. When I uploaded the php file also to the AdminCP directory, the problem was solved (and options.php could find it, in the AdminCP directory, but the file should be normally only in the forums folder).

Edit: I could fix it easily by correcting the product file:
Change the include of the two admin plugins (admin_global and admin_options_processing) to:
PHP Code:

include_once('./template_cache.php'); 

instead of
PHP Code:

include_once('template_cache.php'); 

Note: a require_once function would be better instead of a include_once (also just to follow the vBulletin coding standards).

Edit 2: I discovered a new bug, the archive isn't working any more, you need to add a plugin there too.

I don't know, the plugin works for as distributed (archive works too). Do you have any special settings? Plugins that modify the archive?

Quote:

Originally Posted by Kihon Kata (Post 1144537)
Hi Orban! Merry Christmas.

Question: Does this hack automatically delete the cached template when the template is changed or updated? Mine is doing something strange. The only way I can view an updated template in the browser is to turn off your cacher, update the template, load the page.

Then I turn the cacher back on.

It seems as if the cache is still there until I turn the cacher off.

LMK what this means.

Thanks!

Yes, it should automatically deleted all cached templates when a template is edited/removed/added.

RS_Jelle 12-24-2006 09:02 PM

Quote:

Originally Posted by orban (Post 1144634)
I don't know, the plugin works for as distributed (archive works too). Do you have any special settings? Plugins that modify the archive?

Not that I'm aware of and no plugins for the archive. I don't have any mods that modify vBulletin a lot, only general things like vBadvanced, DownloadsII, glossary, v3 Arcade, Photoplog, ...

Just like Kihon Kata said, changes aren't saved in the template cache on my site also and I need to turn it off and on again for that.

orban 12-24-2006 09:05 PM

Most of those plugins modify vB quite a lot (use a lot of hooks). So it's quite easy for them to mess something up. Can you try to enable them 1 by 1 on a dev board so we can track down the culprit? I can then maybe give you a fix.

RS_Jelle 12-24-2006 09:30 PM

I disabled all products, still the same two problems (and there are no file edits).

But I think it's just the same problem like I had after enabling the mod in the options, the include statement is wrong (I posted a fix for the Admin/options problem).

I changed the third instance of the include statement too and the archive was fixed (without creating new errors on other parts of the site) :)
The template saving bug isn't solved with it.

Kihon Kata 12-25-2006 02:16 AM

Quote:

Originally Posted by orban (Post 1144634)
Yes, it should automatically deleted all cached templates when a template is edited/removed/added.

Based on my description, is it doing that? I don't think it is.

orban 12-25-2006 08:53 AM

I downloaded a fresh 3.6.4 just now and it seems they changed the header of their files.

You have to change template_cache.php:99 (or download the new template_cache.php)

from

Code:

        if (strpos(CVS_REVISION, 'template.php') OR $settings_changed)
to

Code:

        if (strpos($_SERVER['SCRIPT_NAME'], 'template.php') OR $settings_changed)
This fixes the clearing of the templates/ folder when a template is edited/added.

I still can't reproduce the errors RS_Jelle is encountering.

Both include('template_cache.php') and require_once('./template_cache.php') work fine for me.

RS_Jelle 12-25-2006 09:29 AM

Indeed, I think:
PHP Code:

include_once('./template_cache.php'); 

or better (vBulletin coding standards):
PHP Code:

require_once('./template_cache.php'); 

works on all servers, but it seems that the current one (without ./) is being picky for some servers. I don't know why also, but all vBulletin includes are like this.

Why not change it also if it works like that for everyone :)
Thanks for the clear cache update, it works fine now.

orban 12-25-2006 09:37 AM

So, switching to "require_once('./template_cache.php');" and using the new template_cache fixed all your problems?

My idea is that include() is weaker. If you upgrade your board, move to a new server, and forget template_cache.php, it won't break anything if you miss the file, because include() will just complain about a missing file then. Require will stop the execution.

RS_Jelle 12-25-2006 01:06 PM

Include also works if you add ./, I understand your opinion about moving servers etc.

So it would become:
PHP Code:

include_once('./template_cache.php'); 

Another small suggestion: add the version check system and an url to the product xml, that's easier to manage the products on your site.

Kihon Kata 12-25-2006 01:07 PM

Orban, you rock. Thanks for the updated template_cache.php. I have tested this on two template changes and it worked fine. I even tested it on Locigian's webTemplates and it worked fine after I updated them.

Thanks for working on Christmas Day and Merry Christmas to you

orban 12-25-2006 03:17 PM

Quote:

Originally Posted by RS_Jelle (Post 1144871)
Include also works if you add ./, I understand your opinion about moving servers etc.

So it would become:
PHP Code:

include_once('./template_cache.php'); 


The product.xml has "include_once" in the two admin_ hooks and just a single "include" in the style_fetch which shouldn't be called twice in any occasion anyway...hmmm...


Quote:

Originally Posted by RS_Jelle (Post 1144871)
Another small suggestion: add the version check system and an url to the product xml, that's easier to manage the products on your site.

Gonna have a look. Maybe. :)

gothicuser 12-26-2006 06:02 AM

Orban, did you have a chance to look into the vBAdvanced problem mentioned HERE?
This mod is really great, but because we use vBA is untennable at the moment.
Works perfectly from within the 'forum' folder, and has no problem whatever with the few other hacks we have installed (Zoints local/DownloadsII/VBSEO Sitemapper/GARS/GAL)

Thankyou for your time

orban 12-26-2006 08:37 AM

Did you try to set the "Full Path to the Template/ Folder" option? Enter an absolute path.

gothicuser 12-26-2006 10:10 AM

Quote:

Originally Posted by orban (Post 1145198)
Did you try to set the "Full Path to the Template/ Folder" option? Enter an absolute path.

Yes, I did that. One question though, does it need the trailing slash (as in /home/public_html/fred/forum/ ?)

I also notice that it is falling over only on the 'Header/Navbar' replacements that are entered into the vBAdvanced settings. e.g. I have entered replacements for obvious files such as login.php, private.php, memberlist.php etc. and when the template_cache is enabled these links do NOT function (they try to use the 'root' path). I have NOT entered replacements for the gallery or external FAQ installations, but these links DO work.

Clear as mud?? tell me about it :confused:

Thankyou very much for your prompt reply.

orban 12-26-2006 10:24 AM

Quote:

Originally Posted by gothicuser (Post 1145220)
Yes, I did that. One question though, does it need the trailing slash (as in /home/public_html/fred/forum/ ?)

I also notice that it is falling over only on the 'Header/Navbar' replacements that are entered into the vBAdvanced settings. e.g. I have entered replacements for obvious files such as login.php, private.php, memberlist.php etc. and when the template_cache is enabled these links do NOT function (they try to use the 'root' path). I have NOT entered replacements for the gallery or external FAQ installations, but these links DO work.

Clear as mud?? tell me about it :confused:

Thankyou very much for your prompt reply.

It's because many addons use run-time str_replace of templates (don't ask me why).
Yes, trailing slash.

/home/public_html/fred/forum/templates/

Brew 01-01-2007 09:58 PM

Is there a way to get this mod to work with mods that change messages posts?

Specifically this mod:

BBcode Manager 1.32 : New looks for your quote, html, php and code bbcodes !
https://vborg.vbsupport.ru/showthread.php?t=120073

The author of that mod has left it orphaned so I won't get any help there....so I am hoping that something can be done through this mod to make it compatible.

(crossing my fingers)

The problem seems to be that because the message is getting cached it won't allow the new graphics in the above mentioned mod. I'm not really sure why though.

Thanks!

orban 01-02-2007 07:43 AM

Exclude the following templates in the template cache settings:

bbcode_quote
bbcode_code
bbcode_highlight
bbcode_php
bbcode_html

Brew 01-02-2007 01:51 PM

Quote:

Originally Posted by orban (Post 1149006)
Exclude the following templates in the template cache settings:

bbcode_quote
bbcode_code
bbcode_highlight
bbcode_php
bbcode_html

Thank you for going through the hassle for this Orban :)

I tried butting the above in the "Exclude Templates" box in the template cache system but the image quotes still are not displayed.

Again, thanks!

Brew 01-02-2007 05:17 PM

There's another incompatibility :(

After enabling your template cache the "Count of unread posts in the welcome box" stopped working....The hack is here:
https://vborg.vbsupport.ru/showthread.php?p=1149261

Thanks again for your help!

orban 01-02-2007 05:22 PM

navbar

is the template to be excluded.

Brew 01-02-2007 05:42 PM

Quote:

Originally Posted by orban (Post 1149270)
navbar

is the template to be excluded.

Naw....that didn't do it.

When looking at the source there is this:

Code:

<!-- breadcrumb, login, pm info -->
Should I include those? (each seperately?)

Or would that defeat the caching too much?

DementedMindz 01-02-2007 05:46 PM

Quote:

Originally Posted by Brew (Post 1149267)
There's another incompatibility :(

After enabling your template cache the "Count of unread posts in the welcome box" stopped working....The hack is here:
https://vborg.vbsupport.ru/showthread.php?p=1149261

Thanks again for your help!

i have both installed and they work together

Brew 01-02-2007 05:56 PM

Quote:

Originally Posted by DementedMindz (Post 1149288)
i have both installed and they work together

Thanks for your reply DementedMindz!

I got it to work but only after I disabled "Cache Templates Seperately".

Now off to figure out why :/

Brew 01-02-2007 06:46 PM

Quote:

Originally Posted by orban (Post 1149006)
Exclude the following templates in the template cache settings:

bbcode_quote
bbcode_code
bbcode_highlight
bbcode_php
bbcode_html

This doesn't work when I use NO to Cache Templates Separately also. I don't think APC is installed atm anyway so it's better to be turned off.

I've looked all over and can't find other templates that other mod uses. Any ideas?

In case anyone is wondering....there are two issues I'm talking about...one is with the bbcode_quote mod and the other is the "Count of unread posts in the welcome box". The message here is the one about the bbcode_quote.

orban 01-03-2007 03:00 PM

I don't know then sorry :/

thincom2000 01-06-2007 05:11 PM

Quote:

Originally Posted by gothicuser (Post 1145220)
I also notice that it is falling over only on the 'Header/Navbar' replacements that are entered into the vBAdvanced settings. e.g. I have entered replacements for obvious files such as login.php, private.php, memberlist.php etc. and when the template_cache is enabled these links do NOT function (they try to use the 'root' path).

You could modify the navbar to use variables and just set them in the page's code itself (to save a query). This way you can avoid the str_replace, and you don't have to exclude your navbar.

I actually installed this product just to cache my navbar, because it was slowing everything down.

Also, @orban, how would I go about adding templates to this template cache?
I have a number of custom templates that I'm using and I'm tired of seeing the message "4 queries for uncached templates" flash quickly just before the page loads.

I tried creating a plugin that adds the templates to $globaltemplates, but it ... oh, I forgot a closing ')'

This dramatically increases my page load time -- I had been getting complaints about 8 - 16 second page request times, followed by about another 3 - 4 for loading. Now most pages load in 1-2 seconds. XD

orban 01-07-2007 01:10 AM

Quote:

Originally Posted by thincom2000 (Post 1152043)
You could modify the navbar to use variables and just set them in the page's code itself (to save a query). This way you can avoid the str_replace, and you don't have to exclude your navbar.

I actually installed this product just to cache my navbar, because it was slowing everything down.

Also, @orban, how would I go about adding templates to this template cache?
I have a number of custom templates that I'm using and I'm tired of seeing the message "4 queries for uncached templates" flash quickly just before the page loads.

I tried creating a plugin that adds the templates to $globaltemplates, but it ... oh, I forgot a closing ')'

This dramatically increases my page load time -- I had been getting complaints about 8 - 16 second page request times, followed by about another 3 - 4 for loading. Now most pages load in 1-2 seconds. XD

All sorted?

You have to add your custom templates to $globaltemplates that's correct.

thincom2000 01-07-2007 07:40 AM

My custom templates were cached for about an hour, then they weren't cached anymore.

Don't know what to do now... Didn't change anything. Back up to 5 second load times.

Okay, so even though my setting for $vboptions[forumhome] is home.php, my navbar is attempting to go to index.php. And what do you know? Over half my templates folder vanished...

orban 01-07-2007 09:38 AM

That's really weird. Files don't usually just disappear.

Have you tried to manually clear our your template cache folder?

thincom2000 01-07-2007 05:58 PM

Yes. They seem to be coming back now though. The weird thing is that my $vboptions[forumhome] in the navbar is still eval-ing to 'index' even though in vBulletin Options it's set to 'home'

I don't see how it could be an str_replace issue, since it says $vboptions[forumhome] and not 'index' in the template.

Edit:
For some reason my forum had switched to using an older version of my current style that didn't have any updates from the past month.

Everything's working beautifully again.

Brew 01-08-2007 01:32 PM

Man I have been fiddling with this for days and I'm beginning to think this mod isn't working at all....on my site anyway.

If I turn on the cache and go to the following address it reads the same as if the cache were turned off.

http://www.websiteoptimization.com/services/analyze/

Shouldn't the load times change with this mod turned on?

amcd 01-08-2007 01:39 PM

Page load times will change only if your server is creaking under heavy load. If your server is only moderately busy, you may not see any change.

You should see new files being written to the templates directory. If that happens, be assured that it is working.

Also, the benefit will be minimal (or maybe none) unless you have a good php opcode cache along with this hack.

orban 01-08-2007 02:36 PM

This mod is for bigger boards, you usually won't notice any difference on your small board with just a handful people online (if that is your board: http://www.politicalforums.net/).

Brew 01-08-2007 02:57 PM

Well...It's really not a problem for me, load time I mean. I have a 3mb connection.

But there are a couple people complaining about access times to the site.

So I'm trying to make em happy ya know.

orban 01-08-2007 02:59 PM

The template cache doesn't not decrease your page size.

Your site is already gzipped, that's about as good as it can get.

Brew 01-08-2007 03:06 PM

I tried the template compression mod you mentioned earlier in this thread. But I really don't see a difference there either.

But...thanks for your help...

Keep up the good work!

orban 01-09-2007 09:02 AM

yeah it makes basically no difference if your site is gzipped

RobParker 01-09-2007 12:35 PM

Is there any reason why this mod would stop the "Who's been online today" mod from working?

With this enabled it doesn't display. When I disable this, it works fine.

I cleared my template cache directory so it's definitely not just finding an old file.

AzzidReign 01-10-2007 04:01 AM

Question for ya. I used this mod (an earlier version for 3.5.x) and when this cache mod is enabled, I could only use 1 style and the others would come up as white pages. My site has 3 styles and I'm wondering if it has changed so you can have multiple styles and still use this hack.


All times are GMT. The time now is 11:58 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01560 seconds
  • Memory Usage 1,856KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (6)bbcode_php_printable
  • (15)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete