List Info

Thread: Problem with clear_cache and cache groups




Problem with clear_cache and cache groups
user name
2007-05-29 11:15:36
Hello,
I'm using smarty 2.6.18, I've just upgraded from smarty 2.5
(...).
I'm using clear_cache to clear cache groups, it did work
with smarty 2.5
but now it doesn't work anymore. Smarty's config and file
permissions
should be ok because clear_all_caches works correctly, but
if I do a
clear_cache("group1") it doesn't delete the cache
for the page I
displayed using $tpl->display("mytpl",
"group1|group2");
The call to clear_cache returns true... but the files are
still in their
directories.
I'm using php 5.2.2 on gentoo linux with apache2.
How can I debug (and fix) this??

-- 
Francesco

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


Re: Problem with clear_cache and cache groups
user name
2007-05-29 12:02:28
Tuesday May 29 2007, at 18:37, Danilo Buerger wrote:

> $cache_id is the second parameter.

You're right, I did a mistake typing, I'm using 
clear_cache(null, "group1")
and I've been using this call for years, now I've upgraded
php and
smarty, and something isn't working (but clear_all_caches
works!)
I cleared all the compiled tpls and caches (and verified
that the dirs
were empty) after the upgrade. 
I noticed that if I use a non existant cache-id, clear_cache
returns
true too, and this sounds strange to me

Francesco

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


Re: Problem with clear_cache and cache groups
user name
2007-05-29 11:39:58
Did you clear all cache and compiled files upon upgrade?

Francesco Cipriani wrote:
> Hello,
> I'm using smarty 2.6.18, I've just upgraded from smarty
2.5 (...).
> I'm using clear_cache to clear cache groups, it did
work with smarty 2.5
> but now it doesn't work anymore. Smarty's config and
file permissions
> should be ok because clear_all_caches works correctly,
but if I do a
> clear_cache("group1") it doesn't delete the
cache for the page I
> displayed using $tpl->display("mytpl",
"group1|group2");
> The call to clear_cache returns true... but the files
are still in their
> directories.
> I'm using php 5.2.2 on gentoo linux with apache2.
> How can I debug (and fix) this??
>
>   

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


Re: Problem with clear_cache and cache groups
user name
2007-05-31 07:24:56
> I'm using smarty 2.6.18, I've just upgraded from smarty
2.5 (...).
> I'm using clear_cache to clear cache groups, it did
work with smarty 2.5
> but now it doesn't work anymore. 

Trying every available release, I found that the latest
version able to
clear my group caches is 2.6.1. But it not compatible with
php5 (I have:
"Fatal error: using $this when not in object
context").
To test the releases I used the following code

<?php

require('lib/smarty/libs/Smarty.class.php');

$tpl = new Smarty();
$tpl->cache_dir =
"/var/www/localhost/htdocs/test/cache";
$tpl->compile_dir =
'/var/www/localhost/htdocs/test/templates_c';

$res = $tpl->clear_cache(null, "latest");
echo ($res ? "truen" : "falsen");

?>

The root of the cache group is "latest".
Versions until 2.6.1 work, newer not, all things being the
same.

-- 
Francesco

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


Re: Problem with clear_cache and cache groups
user name
2007-05-31 07:45:14
> Trying every available release, I found that the latest
version able to
> clear my group caches is 2.6.1.

I found it! It was use_sub_dirs!!
Until 2.6.1 it was set to true by default, then it was
changed to false.
I had a script which displayed smarty tpls with use_sub_dirs
set to
true, and another script which cleared caches but didn't set
that var
which remained to false, but until 2.6.1 all worked because
of the
default.

-- 
Francesco

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


Re: Problem with clear_cache and cache groups
user name
2007-05-31 08:02:41
On Thu, May 31, 2007 at 02:24:56PM +0200, Francesco Cipriani
wrote:
> > I'm using smarty 2.6.18, I've just upgraded from
smarty 2.5 (...).
> > I'm using clear_cache to clear cache groups, it
did work with smarty 2.5
> > but now it doesn't work anymore. 
> 
> Trying every available release, I found that the latest
version able to
> clear my group caches is 2.6.1.

So you think this regression came into smarty 2004-02-17
(release of
2.6.2) and you are now the first one who uses cache groups
and
encounters this bug?

> But it not compatible with php5 (I have:
> "Fatal error: using $this when not in object
context").
> To test the releases I used the following code
> 
> <?php
> 
> require('lib/smarty/libs/Smarty.class.php');
> 
> $tpl = new Smarty();
> $tpl->cache_dir =
"/var/www/localhost/htdocs/test/cache";
> $tpl->compile_dir =
'/var/www/localhost/htdocs/test/templates_c';
> 
> $res = $tpl->clear_cache(null, "latest");
> echo ($res ? "truen" :
"falsen");
> 
> ?>

your example works fine for me with 2.6.18 and with CVS
head.

in your first mail you asked how you can debug it: use a
single step
debugger like xdebug or dbg. if you cannot or do not want to
use a
debugger add echo statements into your cvs checkout of
smarty to trace
where the code flows and to see where it does not flow the
way you
expect it to flow.

greetings
messju

> The root of the cache group is "latest".
> Versions until 2.6.1 work, newer not, all things being
the same.
> 
> -- 
> Francesco

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


[1-6]

about | contact  Other archives ( Real Estate discussion Medical topics )