Disabling the caching

martin_123

Joined: 2009-04-19
Posts: 9
Posted: Thu, 2011-03-17 22:44

Hi,

I am using Gallery2 and I want to disable the cashing of my photos and .php and .css scripts in the temporary internet folder.
I have found a description to solve this issue in: http://codex.gallery2.org/Gallery1:Securing
However the files that I have to change are in albums.php, slideshow.php, view_photo.php, and view_album.php, and these files only exist in Gallery1 and dont exist in Gallery2.
Can someone please help me to solve this problem?

Thanks,
Martin

 
Dayo

Joined: 2005-11-04
Posts: 1642
Posted: Fri, 2011-03-18 16:09

Please give one good reason why you want to disable caching resources by browsers.

Hint: There is only one such good reason which is that you are writing new code for the site or changing the site layout in which case all you need to do is to switch caching off in your browser.

--
dakanji.com

 
martin_123

Joined: 2009-04-19
Posts: 9
Posted: Sat, 2011-03-19 15:21

Dayo,

You mean there is a plugin for Gallery2 to switch off caching?

 
Dayo

Joined: 2005-11-04
Posts: 1642
Posted: Sat, 2011-03-19 15:30

No. I meant for you to let us know what your reason for wanting to switch browser level caching off globally is ... as there is no logical reason I can think of why anyone would want to do this.

--
dakanji.com

 
martin_123

Joined: 2009-04-19
Posts: 9
Posted: Sat, 2011-03-19 15:37

Dayo,

If you did not read my first post when you responded on it I do advice you to read it first.
If you dont understand what I am saying in my first post I do recommend you to read the link that I included: http://codex.gallery2.org/Gallery1:Securing
If you then still dont understand what the issue is about after reading this, then I cant help you.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sat, 2011-03-19 15:44

gallery2/themes/your theme/templates/local/theme.tpl <- copy the original theme.tpl here and add:

<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">

to the <head />

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
martin_123

Joined: 2009-04-19
Posts: 9
Posted: Sat, 2011-03-19 15:51

Dear suprsidr,

Thank you for your answer.
I had done this, but the caching in the temporary internet folder keeps on.
I dont know what I do wrong, or where things go wrong.

 
Dayo

Joined: 2005-11-04
Posts: 1642
Posted: Sat, 2011-03-19 15:59

Hi.

I have reread the original post and also followed the link.

The code given above will do the job. However, I would not advise implementing this as the advice given in that G1 article is not sound and will just place unnecessary load on your server with no benefit.

As I wrote earlier, there is no logical reason to do this. It doesn't give you any security, it is a waste of time and even worse, will degrade your server performance.

However, if you still feel you want to do this, you can add it to your theme.tpl as said.

Good luck.

--
dakanji.com

 
martin_123

Joined: 2009-04-19
Posts: 9
Posted: Sat, 2011-03-19 16:02

Dear suprsidr and Dayo,

If you both say that the above script is working then I do have to try again.
I dont know what I did wrong, or what went wrong before, but hopely I can get it working.
Thanks.

 
martin_123

Joined: 2009-04-19
Posts: 9
Posted: Sat, 2011-03-19 17:04

it looks so simple but still no succes when I copy the code in theme.tpl

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sat, 2011-03-19 17:10

that method was written many years back.
Browsers may have changed the way they handle those directives. They may even completely ignore them.
You'll have to do a little research yourself. try googling it. http://www.google.com/search?q=META+HTTP-EQUIV%3D"Cache-Control"+CONTENT%3D"no-cache"

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
martin_123

Joined: 2009-04-19
Posts: 9
Posted: Sat, 2011-03-19 22:39

Does Gallery2, slider theme, use Iframe?
In that case there might be a problem with the code below,see:

http://code.google.com/p/chromium/issues/detail?id=28035
Comment 8 by

, Jul 15, 2010

works for me using this in a normal page:
<meta http-equiv="cache-control" content="no-store, no-cache, must-revalidate" />
<meta http-equiv="Pragma" content="no-store, no-cache" />
<meta http-equiv="Expires" content="0" />

does not work if the page is in an iframe!

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sat, 2011-03-19 23:30
Quote:
Does Gallery2, slider theme, use Iframe?

never tried slider. but if it does, you'd need your code in both heads.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2