tags #318893 moreinfo patch
thanks

Can you please try the attached patch? This allows the contents of
/var/cache/torrus to be deleted, but does not handle the directory
vanishing as it would require escalated privileges to re-create.

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany  |  lose things."    Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature |  How to make an American Quilt | Fax: *49 621 72739835
Index: perllib/Torrus/Renderer.pm
===================================================================
RCS file: /cvsroot/torrus/src/perllib/Torrus/Renderer.pm,v
retrieving revision 1.6
diff -u -r1.6 Renderer.pm
--- perllib/Torrus/Renderer.pm  9 Mar 2005 10:01:14 -0000       1.6
+++ perllib/Torrus/Renderer.pm  19 Jul 2005 09:50:42 -0000
@@ -118,22 +118,23 @@
     ($t_render, $t_expires, $filename, $mime_type) =
         $self->getCache( $cachekey );
 
-    if( defined( $filename ) )
-    {
-        if( $t_expires >= time() )
-        {
-            return ($Torrus::Global::cacheDir.'/'.$filename,
-                    $mime_type, $t_expires - time());
-        }
-        # Else reuse the old filename
-    }
-    else
+    my $not_in_cache = 0;
+    
+    if( not defined( $filename ) )
     {
         $filename = Torrus::Renderer::newCacheFileName( $cachekey );
+        $not_in_cache = 1;
     }
 
     my $cachefile = $Torrus::Global::cacheDir.'/'.$filename;
 
+    if( ( not $not_in_cache ) and
+        -f $cachefile and
+        $t_expires >= time() )
+    {
+        return ($cachefile, $mime_type, $t_expires - time());
+    }
+
     my $method = 'render_' . $config_tree->getParam($view, 'view-type');
 
     ($t_expires, $mime_type) =

Reply via email to