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.


All times are GMT. The time now is 08:32 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.01401 seconds
  • Memory Usage 1,755KB
  • 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
  • (2)bbcode_code_printable
  • (5)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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