From 4d7be74fe94b16d155b348414c5e1462d8d692a0 Mon Sep 17 00:00:00 2001 From: taoser Date: Thu, 10 Jun 2021 15:34:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9C=AA=E6=89=A7=E8=A1=8Csq?= =?UTF-8?q?l=E8=AF=AD=E5=8F=A5=E5=88=A0=E9=99=A4sql=E6=96=87=E4=BB=B6bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/Upgrade.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/app/admin/controller/Upgrade.php b/app/admin/controller/Upgrade.php index 89c98fb..0b42e73 100644 --- a/app/admin/controller/Upgrade.php +++ b/app/admin/controller/Upgrade.php @@ -221,8 +221,8 @@ class Upgrade extends AdminController Log::channel('update')->info('update:{type} {progress} {msg}',['type'=>'success','progress'=>'50%','msg'=>'升级文件解压成功!']); + //升级sql操作 $upSql = $zipPath.'runtime/mysql_update.sql'; - //升级执行mysql操作 if(file_exists($upSql)) { $sqlRes = $this->db_update($upSql); @@ -230,12 +230,13 @@ class Upgrade extends AdminController if($upDate['code'] == -1){ return json(['code'=>-1,'msg'=>$upDate['msg']]); } + //删除sql语句 + unlink($upSql); } - + //升级PHP if(is_dir($zipPath)) { - //升级PHP $cpRes = Files::copyDirs($zipPath,$this->root_dir); $cpData = $cpRes->getData(); //更新失败 @@ -253,12 +254,12 @@ class Upgrade extends AdminController return json(['code'=>-1,'msg'=>$cpData['msg']]); } + + Log::channel('update')->info('update:{type} {progress} {msg}',['type'=>'success','progress'=>'70%','msg'=>'升级文件执行成功!']); + //清除 + Files::delDirAndFile($this->upload_dir); + Files::delDirAndFile($this->backup_dir); } - Log::channel('update')->info('update:{type} {progress} {msg}',['type'=>'success','progress'=>'70%','msg'=>'升级文件执行成功!']); - //把解压的升级包清除 - Files::delDirAndFile($this->upload_dir); - Files::delDirAndFile($this->backup_dir); - unlink('../runtime/mysql_update.sql'); Log::channel('update')->info('update:{type} {progress} {msg}',['type'=>'success','progress'=>'100%','msg'=>'升级成功!']); //更新系统的版本号了