Forums | Mahara Themes

General discussion /
I keep having problems clearing cached images


anonymous profile picture
Account deleted
Posts: 47

16 March 2009, 23:24

Hi,  I have been having a great time working on some theme elements. Namely, I have split my header (logo and menu area) area into a left and right header, so I can have more control over my logo placement.  Also having great luck with menus, but more on that later.

 Right now, I seem to get into a situation where my theme gets cached and I can't see changes, no matter if I upload new versions of files, etc.  It is not browser specific.  I do all the normal cache clearing and file deletion in FF, IE, and Chrome, but can't clear things, till like the next day. Is there something in Mahara that does this, or is this some sort of apache thing?

Thanks,

Jamie

PS BTW it is 11:27 pm Florida time, and the post time (NZ says 4:27pm), so what is our time shift???? Innocent

 

anonymous profile picture
Account deleted
Posts: 47

17 March 2009, 0:01

I may be answering my own question, but would appreciate confirmation of my approach.

I can see the images when i path to them in the URL - to anything in the ..static/images/ folder of my theme. It appears that the header.tpl file is not getting updated when I upload or edit it directly.

I see a .htaccess in the /theme folder before default and my theme.  I think those control caching in apache??? So I edited the "access plus 3 days"  to read "now".  A few refreshes and the correct images appear.

Am I crazy (this has driven me crazy) or was that it?  If so, maybe a switch in the site admin settings to disable for rapid testing of theme settings.  Just an idea :-)

Jamie

 

anonymous profile picture
Account deleted
Posts: 1643

17 March 2009, 4:31

Hi - that HTTP level caching stuff is overridden the moment you do a hard reload (anything from Ctrl-R "upwards"). So that's probably not it.

It could well be that smarty on the server is caching your templates, and for some reason you are uploading new templates that don't have a modified time of later than the timestamps being generated for the cached templates. You could check this out by looking at the timestamps directly, or perhaps by just turning off the smarty caching and seeing if it starts working more consistently for you.

Smarty caches its templates in $dataroot/smarty/compile/<theme-name>. I forget the exact way that you tell it to stop caching, but possibly commenting out the compile_dir setting in smarty_core() (lib/web.php) will stop it.

ps: not sure what the smarty cache_dir setting is actually, we set it but I've never found anything in there.

anonymous profile picture
Account deleted
Posts: 47

17 March 2009, 11:22

I was working along great this morning, when right after 11am (EST) something I was testing in the header.tpl file got "stuck" there again.  I am looking at the server clock, which I can't change. It is 1 hour behind me (CDT).  I can see the server time is coming straight thru to Mahara when I post something to my site.  I don;t see any setting in any of the config files for time zone.  I think perhaps my file time is out of sync from when I upload to what is cached, and that stays that way till a certain amount of time goes by.  Not sure, but I think that is what I am seeing happening.  I will wait to see is if it clear on the hour change again.

I will explore the smarty code too and let you know what I find.

Is there a place for us to change the Mahara time?  

Thanks,

Jamie

 

anonymous profile picture
Account deleted
Posts: 47

17 March 2009, 12:30

Not sure how to fix this, as I have never had it be an issue on Plone, Zope, or even my php programming before, but I do have to use a linux touch command on the header.tpl, to get it to not cache.  mmm.

anonymous profile picture
Account deleted
Posts: 1643

17 March 2009, 16:21

By the looks of these two pages:

 http://www.smarty.net/manual/en/variable.compile.check.php

 http://www.smarty.net/manual/en/variable.force.compile.php

You might want to try setting $smarty->force_compile = true; in smarty_core(). It might make things slower, but let's see if that fixes the problem you're having first before worrying about speed Cool

Mahara doesn't have a timezone setting, although it would be a good feature to add (and at a per-user level too). I don't think it would fix this particular issue though, the problem you're having is, I think, that you're uploading templates that are 'in the past' compared with the compiled smarty templates. Maybe if you could upload them without preserving their last modified timestamp it would also be a solution?

6 results