Esempio n. 1
0
 function _getCacheDir($cache_group = 'global', $deleted_cache_dir = false)
 {
     return cache_get_dir($cache_group, $deleted_cache_dir);
     /*if (strval ( $cache_group ) != '') {
     			$cache_group = str_replace ( '/', DIRECTORY_SEPARATOR, $cache_group );
     			
     			//we will seperate the dirs by 1000s
     			$cache_group_explode = explode ( DIRECTORY_SEPARATOR, $cache_group );
     			$cache_group_new = array ();
     			foreach ( $cache_group_explode as $item ) {
     				if (intval ( $item ) != 0) {
     					$item_temp = intval ( $item ) / 1000;
     					$item_temp = ceil ( $item_temp );
     					$item_temp = $item_temp . '000';
     					$cache_group_new [] = $item_temp;
     					$cache_group_new [] = $item;
     				
     				} else {
     					
     					$cache_group_new [] = $item;
     				}
     			
     			}
     			$cache_group = implode ( DIRECTORY_SEPARATOR, $cache_group_new );
     			if ($deleted_cache_dir == false) {
     				$cacheDir = CACHEDIR . $cache_group;
     			} else {
     				$cacheDir = CACHEDIR . 'deleted' . DIRECTORY_SEPARATOR . date ( 'YmdHis' ) . DIRECTORY_SEPARATOR . $cache_group;
     			}
     			if (! is_dir ( $cacheDir )) {
     				
     				mkdir_recursive ( $cacheDir );
     			
     			}
     			
     			return $cacheDir;
     		} else {
     			return $cache_group;
     		}*/
 }
Esempio n. 2
0
function cache_clean_group($cache_group = 'global')
{
    //$startTime = slog_time ();
    /*$cleanPattern = CACHEDIR . $cache_group . DIRECTORY_SEPARATOR . '*' . CACHE_FILES_EXTENSION;
    		
    		$cache_group = $cache_group . DIRECTORY_SEPARATOR;
    		
    		$cache_group = reduce_double_slashes ( $cache_group );
    		
    		if (substr ( $cache_group, - 1 ) == DIRECTORY_SEPARATOR) {
    			
    			$cache_group_noslash = substr ( $cache_group, 0, - 1 );
    		
    		} else {
    			
    			$cache_group_noslash = ($cache_group);
    		
    		}
    		
    		$recycle_bin = CACHEDIR . 'deleted'. DIRECTORY_SEPARATOR;
    		
    		if (is_dir ( $recycle_bin ) == false) {
    			
    			mkdir ( $recycle_bin );
    		
    		}*/
    //print 'delete cache:'  .$cache_group;
    $dir = cache_get_dir('global');
    //$dir_del = cache_get_dir ( 'global', true );
    //var_dump(CACHEDIR . $cache_group);
    if (is_dir($dir)) {
        //dirmv ( $dir, $dir_del, $overwrite = true, $funcloc = NULL );
        recursive_remove_directory($dir);
    }
    $dir = cache_get_dir($cache_group);
    //$dir_del = cache_get_dir ( $cache_group, true );
    //var_dump(CACHEDIR . $cache_group);
    if (is_dir($dir)) {
        //dirmv ( $dir, $dir_del, $overwrite = true, $funcloc = NULL );
        recursive_remove_directory($dir);
    }
}