Changeset 3087

Show
Ignore:
Timestamp:
11/14/05 22:10:28 (3 years ago)
Author:
ryan
Message:

Implement wp_cache_flush().

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-includes/cache.php

    r3086 r3087  
    2020function wp_cache_flush() { 
    2121    global $wp_object_cache; 
     22     
     23    return $wp_object_cache->flush(); 
    2224} 
    2325 
     
    8991    } 
    9092 
     93    function flush() { 
     94        return $this->rm($this->cache_dir . '*');        
     95    } 
     96     
    9197    function get($id, $group = 'default', $count_hits = true) { 
    9298        if ( empty($group) ) 
     
    197203         
    198204        return $this->cache_dir . "$group_dir/"; 
     205    } 
     206 
     207    function rm($fileglob) { 
     208       if (is_file($fileglob)) { 
     209           return @unlink($fileglob); 
     210       } else if (is_dir($fileglob)) { 
     211           $ok = $this->rm("$fileglob/*"); 
     212           if (! $ok) { 
     213               return false; 
     214           } 
     215           return @rmdir($fileglob); 
     216       } else { 
     217           $matching = glob($fileglob); 
     218           if ($matching === false) 
     219               return true; 
     220           $rcs = array_map(array('WP_Object_Cache', 'rm'), $matching); 
     221           if (in_array(false, $rcs)) { 
     222               return false; 
     223           } 
     224       } 
     225       return true; 
    199226    } 
    200227