From 8d625ad0fc80d9de067afef72f06ffc7908c05e9 Mon Sep 17 00:00:00 2001 From: devil_gong Date: Wed, 28 Nov 2018 11:17:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AE=89=E8=A3=85=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AppMini/New/index.html | 1 - .../AppMiniAlipayListController.class.php | 11 ++++- .../Controller/CacheController.class.php | 12 ++---- .../Controller/ThemeController.class.php | 2 +- .../View/Default/AppMiniAlipayList/Index.html | 8 ++-- Application/Common/Common/function.php | 43 ------------------- 6 files changed, 19 insertions(+), 58 deletions(-) delete mode 100755 AppMini/New/index.html diff --git a/AppMini/New/index.html b/AppMini/New/index.html deleted file mode 100755 index 0519ecba6..000000000 --- a/AppMini/New/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/Application/Admin/Controller/AppMiniAlipayListController.class.php b/Application/Admin/Controller/AppMiniAlipayListController.class.php index f67d8061b..daf3f04f6 100755 --- a/Application/Admin/Controller/AppMiniAlipayListController.class.php +++ b/Application/Admin/Controller/AppMiniAlipayListController.class.php @@ -76,7 +76,7 @@ class AppMiniAlipayListController extends CommonController $url = __MY_URL__.'AppMini'.DS.'New'.DS.$this->application_name.DS.$temp_file; $result[] = [ 'name' => $temp_file, - 'url' => $url, + 'url' => substr($url, -4) == '.zip' ? $url : '', 'size' => FileSizeByteToUnit(filesize($file_path)), 'time' => date('Y-m-d H:i:s', filectime($file_path)), ]; @@ -165,7 +165,14 @@ class AppMiniAlipayListController extends CommonController } // 删除压缩包 - if(\Library\FileUtil::UnlinkFile($this->new_path.DS.I('id'))) + $path = $this->new_path.DS.I('id'); + if(substr($path, -4) == '.zip') + { + $status = \Library\FileUtil::UnlinkFile($this->new_path.DS.I('id')); + } else { + $status = \Library\FileUtil::UnlinkDir($this->new_path.DS.I('id')); + } + if($status) { $this->ajaxReturn(L('common_operation_delete_success')); } else { diff --git a/Application/Admin/Controller/CacheController.class.php b/Application/Admin/Controller/CacheController.class.php index a3b416f65..6212827fc 100755 --- a/Application/Admin/Controller/CacheController.class.php +++ b/Application/Admin/Controller/CacheController.class.php @@ -52,13 +52,9 @@ class CacheController extends CommonController */ public function SiteUpdate() { - DelDirFile(TEMP_PATH); - DelDirFile(DATA_PATH); - if(file_exists(RUNTIME_PATH.'common~runtime.php')) - { - unlink(RUNTIME_PATH.'common~runtime.php'); - } - + \Library\FileUtil::UnlinkDir(TEMP_PATH); + \Library\FileUtil::UnlinkDir(DATA_PATH); + \Library\FileUtil::UnlinkFile(RUNTIME_PATH.'common~runtime.php'); $this->success(L('common_operation_update_success')); } @@ -72,7 +68,7 @@ class CacheController extends CommonController public function TemplateUpdate() { // 模板 Cache - DelDirFile(CACHE_PATH); + \Library\FileUtil::UnlinkDir(CACHE_PATH); $this->success(L('common_operation_update_success')); } diff --git a/Application/Admin/Controller/ThemeController.class.php b/Application/Admin/Controller/ThemeController.class.php index cb114419b..480631517 100755 --- a/Application/Admin/Controller/ThemeController.class.php +++ b/Application/Admin/Controller/ThemeController.class.php @@ -168,7 +168,7 @@ class ThemeController extends CommonController } // 开始删除主题 - if(DelDirFile($this->html_path.$id, true) && DelDirFile($this->static_path.$id, true)) + if(\Library\FileUtil::UnlinkDir($this->html_path.$id) && \Library\FileUtil::UnlinkDir($this->static_path.$id)) { $this->ajaxReturn(L('common_operation_delete_success')); } else { diff --git a/Application/Admin/View/Default/AppMiniAlipayList/Index.html b/Application/Admin/View/Default/AppMiniAlipayList/Index.html index 205c52614..98b3cbaa6 100755 --- a/Application/Admin/View/Default/AppMiniAlipayList/Index.html +++ b/Application/Admin/View/Default/AppMiniAlipayList/Index.html @@ -27,9 +27,11 @@ {{$v.size}} {{$v.time}} - - - + + + + + diff --git a/Application/Common/Common/function.php b/Application/Common/Common/function.php index b0e4f9018..e5390809c 100755 --- a/Application/Common/Common/function.php +++ b/Application/Common/Common/function.php @@ -356,49 +356,6 @@ function GetClientIP($long = false) return $onlineip; } -/** - * [DelDirFile 删除指定目录下的所有文件] - * @author Devil - * @blog http://gong.gg/ - * @version 0.0.1 - * @datetime 2017-01-11T18:30:37+0800 - * @param [string] $dir_name [目录地址] - * @param [boolean] $is_del_dir [是否删除目录(默认false)] - * @return [boolean] [成功true, 失败false] - */ -function DelDirFile($dir_name, $is_del_dir = false) -{ - $error = 0; - if($handle = opendir($dir_name)) - { - while(false !== ($item = readdir($handle))) - { - if($item != '.' && $item != '..' ) - { - if(is_dir("{$dir_name}/{$item}")) - { - DelDirFile("$dir_name/$item", $is_del_dir); - } else { - if(!is_writable("$dir_name/$item") || !unlink("$dir_name/$item")) - { - $error++; - } - } - } - } - - // 关闭目录句柄 - closedir($handle); - - // 是否删除目录 - if($is_del_dir == true && !rmdir($dir_name)) - { - $error++; - } - } - return ($error == 0); -} - /** * [UrlParamJoin url参数拼接] * @author Devil -- GitLab