Part of the EllisLab Network
   
 
cache_delete_all and big problem
Posted: 20 January 2007 02:44 PM   [ Ignore ]  
Summer Student
Avatar
Total Posts:  3
Joined  12-06-2006

Hi

I have a big problem with $this->db->cache_delete_all(). In config/database.php i have $db[‘default’][‘cachedir’] = “cache/database”; and when I put in my application $this->db->cache_delete_all() it’s deleting not only controller+action folder but it’s deleting all database folder from cache… It’s way to fix this?

edit:

I resolve that problem in CodeIgniter is a bug… I must change in database/DB_cache.php i function delete_all from delete_files($this->CI->db->cachedir, TRUE); to delete_files($this->CI->db->cachedir, false); and it’s work fine

Profile
 
 
Posted: 20 January 2007 10:22 PM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  310
Joined  08-16-2006

It’s not a bug and is working as designed.

Follow the flow:

cache_delete_all()

calls

delete_all()

which calls

delete_files($this->CI->db->cachedir, TRUE);

The third parameter of delete_files(), $level, defaults to zero and increments each time a directory is found while deleting files thus creating a true condition for the following line:

if ($del_dir == TRUE AND $level > 0)

That said, the workaround (to prevent any sub-directories from being deleted) is as you described.

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: 66431 Total Logged-in Users: 28
Total Topics: 84798 Total Anonymous Users: 2
Total Replies: 455090 Total Guests: 210
Total Posts: 539888    
Members ( View Memberlist )
Newest Members:  GlennJDylan1978X_franbaguasllogocsaturkeyPeter BryanttherendStudioGeorgiaJZeer