function _get_ini_cache_size()
  {
    $size = 0;
    $files = fs :: find_subitems(CACHE_DIR, 'f');
	  foreach($files as $file)
	    $size += filesize($file);     
	  
	  return $size;  
  }
 function _add_project_controllers(&$result)
 {
     $items = fs::find_subitems(PROJECT_DIR . '/core/controllers/', 'f', '', false);
     sort($items);
     foreach ($items as $item) {
         $class = $this->_clean_class_path($item);
         $result[$class] = $class;
     }
 }
  function _add_project_site_objects(&$result)
  {
    $items = fs :: find_subitems(PROJECT_DIR . '/core/model/site_objects/', 'f', '', false);

    foreach($items as $item)
    {
      $class = $this->_clean_class_path($item);
      $result[$class] = $class;
    }
  }
 function perform(&$request, &$response)
 {
     $files = fs::find_subitems(CACHE_DIR, 'f');
     foreach ($files as $file) {
         unlink($file);
     }
     if ($request->has_attribute('popup')) {
         $response->write(close_popup_response($request));
     }
     $request->set_status(REQUEST_STATUS_SUCCESS);
 }
 function get_cache_size()
 {
     fs::mkdir(PAGE_CACHE_DIR);
     $files = fs::find_subitems(PAGE_CACHE_DIR, 'f', '~^[^p]~');
     $size = 0;
     foreach ($files as $file) {
         $size += filesize($file);
     }
     return $size;
 }
 function get_cache_size()
 {
   $files = fs :: find_subitems(IMAGE_CACHE_DIR, 'f');
   
   $size = 0;
   
   foreach($files as $file)
   {
     $size += (filesize($file));
   }  
   
   return $size;
 }
示例#7
0
 function find_subdirs($dir, $full_path = false, $include_hidden = false, $exclude_items = false)
 {
 	return fs :: find_subitems($dir, 'd', $full_path, $include_hidden, $exclude_items);
 }
  function test_find_subitems()
  {
  	$this->_create_file_system();
  	
  	$res = fs :: find_subitems(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/hey');
	sort($res);
  	
  	$this->assertEqual(
  		$res, 
  		array(
  			fs :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/hey/test3_1'),
  			fs :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/hey/test3_2'),
  			fs :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/hey/test3_3')
  		)
  	);

  	$res = fs :: find_subitems(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/', 'f', '/^test2_1$/');
  	sort($res);
	
  	$this->assertEqual(
  		$res, 
  		array(
  			fs :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/test2_2'),
  			fs :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/test2_3'),
  		)
  	);
  	
  	$this->_remove_file_system();
  }
 function test_flush()
 {
     $this->_write_simple_cache('f_test1', $content1 = 'test-content1');
     $this->_write_simple_cache('f_test2', $content2 = 'test-content2');
     $this->_write_simple_cache('not_page_file', $content3 = 'test-content3');
     $cache_manager =& new full_page_cache_manager();
     $cache_manager->flush();
     $files = fs::find_subitems(PAGE_CACHE_DIR);
     $this->assertEqual(sizeof($files), 1);
     $file = reset($files);
     $this->assertEqual(fs::clean_path($file), fs::clean_path(PAGE_CACHE_DIR . fs::separator() . 'not_page_file'));
     $this->_clean_simple_cache('not_page_file');
 }
 /**
  * Clean the cache
  * 
  * if no group is specified all cache files will be destroyed
  * else only cache files of the specified group will be destroyed
  * 
  * @param string $group name of the cache group
  * @return boolean true if no problem
  * @access public 
  */
 function clean($group = false)
 {
     if ($this->_file_name_protection) {
         $motif = $group ? 'cache_' . md5($group) . '_' : 'cache_';
     } else {
         $motif = $group ? 'cache_' . $group . '_' : 'cache_';
     }
     if ($this->_memory_caching) {
         while (list($key, $value) = each($this->_memory_caching)) {
             if (strpos($key, $motif, 0)) {
                 unset($this->_memory_caching[$key]);
                 $this->_memory_caching_counter = $this->_memory_caching_counter - 1;
             }
         }
         if ($this->_only_memory_caching) {
             return true;
         }
     }
     $items = fs::find_subitems($this->_cache_dir, 'f');
     foreach ($items as $file) {
         if (strpos($file, $motif) !== false) {
             if (!@unlink($file)) {
                 debug::write_error('Unable to remove cache !', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__);
                 return false;
             }
         }
     }
     clearstatcache();
     return true;
 }