diff --git a/application/index/controller/admin/System.php b/application/index/controller/admin/System.php index a7832662..77641de1 100644 --- a/application/index/controller/admin/System.php +++ b/application/index/controller/admin/System.php @@ -104,8 +104,10 @@ class System extends Base $upgradeFile = app()->getRuntimePath() . 'upgrade.zip';// 判断是否存在安装包 $file = file_exists($upgradeFile) ? $upgradeFile : $upgrade->download($release->url); + // 校验 MD5 if (md5_file($file) !== $release->md5) { + @unlink(app()->getRootPath() . $backup); throw new \Exception('安装包损坏, 请稍后重试'); } diff --git a/extend/Upgrade.php b/extend/Upgrade.php index b7b88611..122f51da 100644 --- a/extend/Upgrade.php +++ b/extend/Upgrade.php @@ -88,7 +88,7 @@ class Upgrade curl_setopt($curl, CURLOPT_TIMEOUT, 180); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 180); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); - curl_setopt($curl, CURLOPT_HEADER, 1); + curl_setopt($curl, CURLOPT_HEADER, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); $contents = curl_exec($curl); diff --git a/public/static/app/js/app.js b/public/static/app/js/app.js index fd8d8e07..f1cc41a8 100644 --- a/public/static/app/js/app.js +++ b/public/static/app/js/app.js @@ -156,7 +156,7 @@ var app = { modal: true, buttons: [], closeOnEsc: false, - content: '
升级中, 请不要关闭窗口...
' + content: '
升级中, 请不要关闭窗口...
' }); $d.$dialog.css({'max-width': '300px'}); mdui.mutation();