Part of the EllisLab Network
   
 
Calling cache_delete() when the cache directory is missing trailing ’/’ slash
Posted: 05 June 2008 10:02 AM   [ Ignore ]  
Summer Student
Total Posts:  10
Joined  10-31-2007

I found a bug whereby the cache directory (defined in /system/application/config/database.php) must contain a trailing slash.  Otherwise when you call

$this->db->cache_delete()

it does not do anything (since it cannot find the directory.

There is a function defined in /system/database/DB_cache.php called check_path() which is called at the beginning of the read() and write() operations.  This function includes a preg_replace() that will add the trailing slash if it is missing.  That code is here:

// Add a trailing slash to the path if needed
$path = preg_replace("/(.+?)\/*$/", "\\1/",  $path);

This function is not called at the beginning of cache_delete() .  If this was intentional, it seems counter-intuitive to have it there for the read() and write() operations, since it causes confusion as to why the db cache only works sometimes (as I experienced).  If not, it should be fixed in the next version.  Thanks.

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 719, on June 06, 2008 10:16 AM
Total Registered Members: 62600 Total Logged-in Users: 25
Total Topics: 77073 Total Anonymous Users: 1
Total Replies: 416277 Total Guests: 140
Total Posts: 493350    
Members ( View Memberlist )
Newest Members:  eudj1nsehartEasyMLance SloanandrewjhscottShuvopatricovghazalravi_ghostblade_kaqfa