View Issue Details

IDProjectCategoryView StatusLast Update
0000430WackoWikicachepublic2014-03-21 13:00
Reportervaraha Assigned Toadministrator  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
PlatformCloud ServerOSFedoraOS Version17
Product Version5.1.0 
Target Version5.4.0Fixed in Version5.4.0 
Summary0000430: cache patch
DescriptionPatch solves two problems:

1. Zero size or bad cached pages tried to show
2. Cached pages had't "Content-Type:" header line
Additional Information--- cache.php.orig 2012-10-19 09:59:39.146100182 +0000
+++ cache.php 2012-10-19 09:12:23.866100180 +0000
@@ -82,24 +82,27 @@
             return false;
         }
 
         if ((time() - ($timestamp = @filemtime($filename))) > $this->cache_ttl)
         {
+ unlink($filename);
             return false;
         }
 
         $fp = fopen($filename, 'r');
         $size = filesize($filename);
 
         if (empty($size))
         {
+ unlink($filename);
             return false;
         }
 
         // check for false and empty strings
         if(($contents = fread($fp, $size)) === '')
         {
+ unlink($filename);
             return false;
         }
 
         $contents = "<!-- WackoWiki Caching Engine: page cached at ".date('Y-m-d H:i:s', $timestamp).", contents follows -->\n".$contents;
         fclose($fp);
@@ -261,11 +264,11 @@
         }
 
         $this->log('check_http_request query='.$query);
 
         //check cache
- if ($mtime = $this->get_cached_time($page, $method, $query))
+ if (($mtime = $this->get_cached_time($page, $method, $query)) && ($cached = $this->get_cached($page, $method, $query)))
         {
             $this->log('check_http_request incache mtime='.$mtime);
 
             $gmt = gmdate('D, d M Y H:i:s \G\M\T', $mtime);
             $etag = (isset($_SERVER['HTTP_IF_NONE_MATCH']) ? $_SERVER['HTTP_IF_NONE_MATCH'] : '');
@@ -285,14 +288,16 @@
                 {
                     header ("HTTP/1.1 304 Not Modified");
                     die();
                 }
 
- $cached = $this->get_cached($page, $method, $query);
+ //$cached = $this->get_cached($page, $method, $query);
                 header ("Last-Modified: ".$gmt);
                 header ("ETag: \"".$gmt."\"");
                 //header ("Content-Type: text/xml");
+ header("Content-Type: text/html; charset=".$this->get_charset());
                 //header ("Content-Length: ".strlen($cached));
                 //header ("Cache-Control: max-age=0");
                 //header ("Expires: ".gmdate('D, d M Y H:i:s \G\M\T', time()));
                 echo ($cached);
 
TagsNo tags attached.

Relationships

related to 0000320 resolvedadministrator page cache should also depend on language 
related to 0000429 closed Cache swallows part of html code around "breadcrumb" 

Activities

administrator

2012-10-20 05:12

administrator   ~0000872

There is still a nasty charset issue.

The users charset __can__ be different from the cache charset.
UTF8 will probably solve this issue but in this case the wacko engine should invalidate the cache. The cache table already has a 'lang' field, see also 0000320

administrator

2012-10-20 05:19

administrator   ~0000873

header("Content-Type: text/html; charset=".$this->get_charset());

$this->get_charset() is not available in the cache class?
There is a similar case in the RSS class.

administrator

2013-01-19 22:21

administrator   ~0000880

change sets
http://wackowiki.hg.sourceforge.net/hgweb/wackowiki/dev/rev/d7b1c8567d6d
http://wackowiki.hg.sourceforge.net/hgweb/wackowiki/dev/rev/4866a83b8250

Issue History

Date Modified Username Field Change
2012-10-19 10:05 varaha New Issue
2012-10-20 04:26 administrator Relationship added related to 0000429
2012-10-20 05:12 administrator Note Added: 0000872
2012-10-20 05:12 administrator Assigned To => administrator
2012-10-20 05:12 administrator Status new => assigned
2012-10-20 05:12 administrator Relationship added related to 0000320
2012-10-20 05:19 administrator Note Added: 0000873
2013-01-19 22:21 administrator Note Added: 0000880
2014-03-18 11:22 administrator Fixed in Version => 5.4.0
2014-03-18 11:22 administrator Target Version => 5.4.0
2014-03-18 11:23 administrator Status assigned => resolved
2014-03-18 11:23 administrator Resolution open => fixed
2014-03-21 13:00 administrator Summary classes/cache.php patch => cache patch