From ba7fc61732b32f05427f86305740c64b8c6f1156 Mon Sep 17 00:00:00 2001 From: augushong Date: Fri, 8 Dec 2023 16:46:49 +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 | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/extend/base/admin/service/AdminUpdateServiceBase.php b/extend/base/admin/service/AdminUpdateServiceBase.php index d5a0231..bde163a 100644 --- a/extend/base/admin/service/AdminUpdateServiceBase.php +++ b/extend/base/admin/service/AdminUpdateServiceBase.php @@ -175,6 +175,20 @@ class AdminUpdateServiceBase foreach ($changed_files as $file_path => $type) { if ($type == 'add') { + // 最新版本有,但是现存版本没有,有可能是新版本增加的,也有可能是用户删除的 + if ($this->testIsOptionalFiles($file_path)) { + // 判断是否是新版本增加的 + if(in_array($file_path, $current_version_files)){ + // 如果是新版本增加的,则直接处理 + $need_process_files[$file_path] = $type; + continue; + } + + // 如果是用户删除了的,则提示用户处理 + $optional_update_waring_files[$file_path] = $type; + continue; + } + // 如果是强制更新的部分,则应当直接处理 $need_process_files[$file_path] = $type; continue; } @@ -196,6 +210,19 @@ 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 {