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 |
Jump to:
Description
File engine fixes.
| Attachment | Size |
|---|---|
| file-engine-fix.patch | 764 bytes |

#1
This does fix issue with with 'engine' => 'file', as reported at http://drupal.org/node/353815
#2
Phew. I'm glad I found this.
Can someone add this patch into the trunk already? It's kind of important.
#3
Subscribing
#4
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
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
subscribing
#7
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
Fixed in cvs commit: http://drupal.org/cvs?commit=258754
#9
Automatically closed -- issue fixed for 2 weeks with no activity.