File engine fixes

doq - June 16, 2009 - 14:44
Project:Cache Router
Version:6.x-1.0-beta8
Component:Code
Category:bug report
Priority:critical
Assigned:doq
Status:closed
Description

File engine fixes.

AttachmentSize
file-engine-fix.patch764 bytes

#1

najibx - July 8, 2009 - 04:09

This does fix issue with with 'engine' => 'file', as reported at http://drupal.org/node/353815

#2

picardo - July 8, 2009 - 10:42

Phew. I'm glad I found this.

Can someone add this patch into the trunk already? It's kind of important.

#3

vacilando - July 8, 2009 - 20:01

Subscribing

#4

EnekoAlonso - July 27, 2009 - 23:07

Another issue I have found with File engine is that my cached pages where getting deleted very soon from disk. I looked everywhere for the right configuration, and even took a look at the values of the cache variables on my Drupal DB. But the issue was in the code.

The purge function was referring to a global variable $cache_lifetime which is not defined anywhere. Thus, all files where being deleted every time purge was called. I fixed this by calling variable_get instead:

<?php
 
function purge($dir) {
   
// global $cache_lifetime;
   
$cache_lifetime = variable_get('cache_lifetime', 0);     // <--- Fixed!

   
$files = file_scan_directory($dir, '.', array('.', '..', 'CVS'));
    foreach (
$files as $file) {
      if (
filemtime($file->filename) < (time() - $cache_lifetime)) {
        if (
$fp = fopen($file->filename, 'r')) {
         
// We need an exclusive lock, but don't block if we can't get it as
          // we can simply try again next time cron is run.
         
if (flock($fp, LOCK_EX|LOCK_NB)) {
           
unlink($file->filename);
          }
        }
      }
    }
  }
?>

Thanks

#5

Divisive Cottonwood - August 24, 2009 - 16:50

I've installed CacheRouter on two different sites but even after using the above fix I'm still getting exactly the same error:

Missing argument 1 for dbCache::flush(), called in /home/jonty/public_html/example.com/sites/all/modules/cacherouter/CacheRouter.php on line 57 and defined in /home/jonty/public_html/examplef.com/sites/all/modules/cacherouter/engines/db.php on line 83.

#6

sinasalek - August 29, 2009 - 07:13

subscribing

#7

sinasalek - August 29, 2009 - 07:15

Another issue , Appears on almost every page :
warning: fopen() expects parameter 1 to be string, object given in /home/base/public_html/teamwork/sites/all/modules/cacherouter/engines/file.php on line 113

#8

slantview - September 3, 2009 - 06:33
Status:needs review» fixed

Fixed in cvs commit: http://drupal.org/cvs?commit=258754

#9

System Message - September 17, 2009 - 06:40
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.