diff options
author | Robin Appelman <icewind1991@gmail.com> | 2010-10-15 23:42:58 +0000 |
---|---|---|
committer | Robin Appelman <icewind1991@gmail.com> | 2010-10-15 23:42:58 +0000 |
commit | a98dfbbf71336f4f0fbf4299c101239aaa65826b (patch) | |
tree | 230278a4053e35506018652d017f4266ca04d12f /inc/lib_files.php | |
parent | 494d88a4353799ae2fbc2631578664715c063c7e (diff) | |
download | nextcloud-server-a98dfbbf71336f4f0fbf4299c101239aaa65826b.tar.gz nextcloud-server-a98dfbbf71336f4f0fbf4299c101239aaa65826b.zip |
plugin manager and plugin installer
Diffstat (limited to 'inc/lib_files.php')
-rwxr-xr-x | inc/lib_files.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/inc/lib_files.php b/inc/lib_files.php index 94eff9ce59c..c8c26df9726 100755 --- a/inc/lib_files.php +++ b/inc/lib_files.php @@ -306,6 +306,24 @@ function zipAddDir($dir,$zip,$internalDir=''){ } } +//remove a dir and it's content +function delTree($dir) { + if (!file_exists($dir)) return true; + if (!is_dir($dir) || is_link($dir)) return unlink($dir); + foreach (scandir($dir) as $item) { + if ($item == '.' || $item == '..') continue; + if(is_file($dir.'/'.$item)){ + unlink($dir.'/'.$item); + }elseif(is_dir($dir.'/'.$item)){ + if (!delTree($dir. "/" . $item)){ + return false; + }; + } + } + $return=rmdir($dir); + return $return; +} + if(!function_exists('sys_get_temp_dir')) { function sys_get_temp_dir() { if( $temp=getenv('TMP') ) return $temp; @@ -320,6 +338,22 @@ if(!function_exists('sys_get_temp_dir')) { } } +function recursive_copy($src,$dst) { + $dir = opendir($src); + @mkdir($dst); + while(false !== ( $file = readdir($dir)) ) { + if (( $file != '.' ) && ( $file != '..' )) { + if ( is_dir($src . '/' . $file) ) { + recursive_copy($src . '/' . $file,$dst . '/' . $file); + } + else { + copy($src . '/' . $file,$dst . '/' . $file); + } + } + } + closedir($dir); +} + global $FAKEDIRS; $FAKEDIRS=array(); |