From fcfc077195afd11a63586baea0168562e625a34e Mon Sep 17 00:00:00 2001 From: augushong Date: Fri, 8 Dec 2023 17:07:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9B=B4=E6=96=B0=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/service/AdminUpdateServiceBase.php | 37 +++++++++++++------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/extend/base/admin/service/AdminUpdateServiceBase.php b/extend/base/admin/service/AdminUpdateServiceBase.php index d79b5c7..9aad1af 100644 --- a/extend/base/admin/service/AdminUpdateServiceBase.php +++ b/extend/base/admin/service/AdminUpdateServiceBase.php @@ -193,6 +193,31 @@ class AdminUpdateServiceBase continue; } + if ($type == 'delete') { + if ($this->testIsOptionalFiles($file_path)) { + // 最新版本没有,但是现存版本有,有可能是新版本删除的,也有可能是用户增加的 + + if (in_array($file_path, $current_version_files)) { + // 如果这个文件在当前版本中存在,则是新版本删除的,提示用户处理,因为用户改动了他,可能不希望被删除 + $optional_update_waring_files[$file_path] = $type; + continue; + } + + // 如果这个文件在当前版本中不存在,则是用户增加的,跳过 + continue; + } + // 如果是强制更新的部分 + + if (in_array($file_path, $current_version_files)) { + // 如果这个新建的文件,在当前版本中存在,则是新版本删除的,直接处理 + $need_process_files[$file_path] = $type; + continue; + } + + // 如果这个文件在当前版本中不存在,则是用户增加的,跳过 + continue; + } + $now_file_path = $now_dir . '/' . $file_path; $current_file_path = $current_version_dir . '/' . $file_path; $last_file_path = $last_version_dir . '/' . $file_path; @@ -210,18 +235,6 @@ class AdminUpdateServiceBase } if ($this->testIsOptionalFiles($file_path)) { - if ($type == 'delete') { - // 最新版本没有,但是现存版本有,有可能是新版本删除的,也有可能是用户增加的 - - if (in_array($file_path, $current_version_files)) { - // 如果这个文件在当前版本中存在,则是新版本删除的,提示用户处理,因为用户改动了他,可能不希望被删除 - $optional_update_waring_files[$file_path] = $type; - continue; - } - - // 如果这个文件在当前版本中不存在,则是用户增加的,跳过 - continue; - } // 可选更新的文件发生了变化,提示用户手动维护上游信息 $optional_update_waring_files[$file_path] = $type; } else {