File engine fixes.

CommentFileSizeAuthor
file-engine-fix.patch764 bytesdoq

Comments

najibx’s picture

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

picardo’s picture

Phew. I'm glad I found this.

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

vacilando’s picture

Subscribing

EnekoAlonso-1’s picture

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:

  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

AndyW’s picture

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.

sinasalek’s picture

subscribing

sinasalek’s picture

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

slantview’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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