Welcome Guest, Not a member yet? Register   Sign In
Calling cache_delete() when the cache directory is missing trailing '/' slash
#1

[eluser]jeffpeck[/eluser]
I found a bug whereby the cache directory (defined in /system/application/config/database.php) must contain a trailing slash. Otherwise when you call
Code:
$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:

Code:
// 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.




Theme © iAndrew 2016 - Forum software by © MyBB