コード例 #1
0
  function _get_directory_file_size($dir)
  {
    $size = 0;
    $files = fs :: find($dir, 'f');
    foreach($files as $file)
      $size += filesize($file);

    return $size;
  }
  function _add_project_controllers(&$result)
  {
    $items = fs :: find(PROJECT_DIR . '/core/controllers/', 'f', null, null, false);

    sort($items);
    foreach($items as $item)
    {
      $class = $this->_clean_class_path($item);
      $result[$class] = $class;
    }
  }
コード例 #3
0
  function perform(&$request, &$response)
  {
    $files = fs :: find(VAR_DIR . '/compiled', 'f');
    foreach($files as $file)
      unlink($file);

    if($request->has_attribute('popup'))
      $response->write(close_popup_response($request));

    $request->set_status(REQUEST_STATUS_SUCCESS);
  }
コード例 #4
0
  function get_cache_size()
  {
    $files = fs :: find(IMAGE_CACHE_DIR, '~^f~');

    $size = 0;
    foreach($files as $file)
      $size += (filesize($file));

    return $size;
  }
コード例 #5
0
  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(PAGE_CACHE_DIR);

    $this->assertEqual(sizeof($files), 1);

    $file = reset($files);
    $this->assertEqual(fs :: normalize_path($file), fs :: normalize_path(PAGE_CACHE_DIR . fs :: separator() . 'not_page_file'));

    $this->_clean_simple_cache('not_page_file');
  }
コード例 #6
0
 function _remove_file_cache($group = false, $key = false)
 {
   if($key)
   {
     @unlink($this->_get_cache_file_path($group, $key));
   }
   else
   {
     $files = fs :: find(CACHE_DIR, 'f', '~^' . preg_quote($this->_get_cache_file_prefix($group)) . '~');
     foreach($files as $file)
       @unlink($file);
   }
 }
コード例 #7
0
  function test_find()
  {
    $this->_create_file_system();

    $res = fs :: find(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/hey');

    $this->assertEqual(
      $res,
      array(
        fs :: normalize_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/hey/test3_1'),
        fs :: normalize_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/hey/test3_2'),
        fs :: normalize_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/hey/test3_3')
      )
    );

    $res = fs :: find(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/', 'f', null, '/^test2_1$/');
    sort($res);

    $this->assertEqual(
      $res,
      array(
        fs :: normalize_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/test2_2'),
        fs :: normalize_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/test2_3'),
      )
    );

    $this->_remove_file_system();
  }
コード例 #8
0
  function _do_recursive_find($dir, $file, $path, $params, &$return_params)
  {
    if(!is_dir($path))
      return;

    $items = fs :: find($path, $params['types'], $params['include_regex'], $params['exclude_regex'], $params['add_path'], $params['include_hidden']);
    foreach($items as $item)
    {
      $return_params[] = $item;
    }
  }