Xataface  2.0alpha2
Xataface Application Framework
 All Data Structures Namespaces Files Functions Variables Groups Pages
clear_cache.php
Go to the documentation of this file.
1 <?php
2 if ( !function_exists('scandir') ){
3  function scandir($dir, $sortorder = 0 ){
4  if ( is_dir($dir) && $dirlist = @opendir($dir)) {
5  while (($file = readdir($dirlist)) !== false ){
6  $files[] = $file;
7  }
8  closedir($dirlist);
9  ($sortorder == 0) ? asort($files) : rsort($files);
10  return $files;
11  } else return false;
12  }
13 }
14 
16  function handle(&$params){
17  $templates_dirs = array(
18  DATAFACE_SITE_PATH.'/templates_c',
19  DATAFACE_PATH.'/templates_c'
20  );
21  foreach ( $templates_dirs as $f ){
22  if ( is_dir($f) ){
23  foreach ( scandir($f) as $dir ){
24  if ( $dir == '.' or $dir == '..' ) continue;
25  $this->deltree($f.'/'.$dir);
26  }
27  }
28  }
29  }
30 
31  function deltree( $f ){
32  if ( is_dir($f) ){
33  foreach (scandir($f) as $item){
34  if ( $item == '.' or $item == '..') continue;
35  $this->deltree($f.'/'.$item);
36  }
37  rmdir($f);
38  } else {
39  unlink($f);
40  }
41 
42  }
43 }