This is one of those facinating problems:

As far as I can see this might work..

anyone know about http head requests??? - can it be detected?

this script assumes that if a cache file exists then it should pump it out..
now if you 'exit' in the page, then in theory no cache file will be generated.
?? I have no idea what happens to ob_start though?????
may also be worth adding a 'if $AUTH' or if !$midgard->sitegroup ???


the cache file expires every hour... (i think)

thoughts on fine tuning this, something like it could go in the manual???


in the midgard-root.php (php4 only)

if (($REQUEST_METHOD="GET") && !ereg("?",$REQUEST_URI)) {
  // look for a cache file
  $ob_cachefile = "/tmp/cache/" .md5($HTTP_HOST . $REQUEST_URI);
  // self expiry :)
  if (file_exists($ob_cachefile)) 
    $filetime = filemtime($ob_cachefile);
    $expiry = $filetime + 1200
    if ($expiry < time()) {
      unlink($ob_cachefile);
    } else {
      header("Expiry: " .date(..... $expiry));
      header("Last-Modified: " .$filetime);
      // stop here if the on head request - HOW???
      passthru("cat $ob_cachefile);
      exit;
    }
  }
  ob_start();
// or even  ob_start ("ob_gzhandler"); 
}  
   
// the mgd_template_stuff... here
    
if ($ob_cachefile) {
  $fh = fopen($ob_cachefile,"w");
  fwrite($fh, ob_get_contents()); 
  fclose($fh);
}
ob_end_clean();  


> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 



-- 
Technical Director
Linux Center (HK) Ltd.
www.hklc.com



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to