From c0191452f16250a45f5ad59c4c7e0073fe8ce600 Mon Sep 17 00:00:00 2001 From: zhaoxiang <756958008@qq.com> Date: Sun, 20 Nov 2016 19:22:52 +0800 Subject: [PATCH] =?UTF-8?q?modified=20=E5=AE=8C=E6=88=90=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E6=AD=A5=E9=AA=A4=E7=9A=84=E7=AC=AC=E4=B8=89=E6=AD=A5=EF=BC=8C?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E6=95=B0=E6=8D=AE=E5=BA=93=E5=92=8C=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E7=9A=84=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/install/controller/Index.php | 40 +++++++++++++++-------- application/install/view/index/step3.html | 4 +-- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/application/install/controller/Index.php b/application/install/controller/Index.php index 05561ff..92be073 100644 --- a/application/install/controller/Index.php +++ b/application/install/controller/Index.php @@ -2,6 +2,7 @@ namespace app\install\controller; use think\Controller; +use think\Db; class Index extends Controller { public function index(){ @@ -37,7 +38,7 @@ class Index extends Controller { $data['cache']['ip'] = '127.0.0.1'; } if( empty($data['cache']['port']) ){ - $data['cache']['ip'] = 6379; + $data['cache']['port'] = 6379; } } if( empty($data['admin']['name']) ){ @@ -54,7 +55,7 @@ class Index extends Controller { $this->success('参数正确开始安装', url('step3')); }else{ $step = session('step'); - if($step != 1){ + if($step != 1 && $step != 4){ $this->error("请按顺序安装", url('index')); }else{ session('error', false); @@ -68,12 +69,10 @@ class Index extends Controller { if( $step != 2){ $this->error("请按顺序安装", url('index')); }else{ -// session('step', 3); + session('step', 3); session('error', false); $dbConfig = session('dbConfig'); $cacheConfig = session('cacheConfig'); - $adminConfig = session('adminConfig'); - $isCover = session('isCover'); //环境检测 $this->assign('checkEnv', checkEnv()); //目录文件读写检测 @@ -84,7 +83,7 @@ class Index extends Controller { }else{ $this->assign('checkDB', checkMongoDB()); } - if( $cacheConfig['type'] != 0 ){ + if( $cacheConfig['type'] == 1 ){ $this->assign('checkCache', checkRedis()); } $this->assign('checkOther', checkOther()); @@ -102,15 +101,28 @@ class Index extends Controller { }else{ session('step', 4); session('error', false); + $dbConfig = session('dbConfig'); + $cacheConfig = session('cacheConfig'); + $adminConfig = session('adminConfig'); + $isCover = session('isCover'); - //环境检测 - $this->assign('checkEnv', checkEnv()); - - //目录文件读写检测 - $this->assign('checkDirFile', checkDirFile()); - - //函数及扩展库检测 - $this->assign('checkFuncAndExt', checkFuncAndExt()); + //检测数据库连接 + if( $dbConfig['DB_TYPE'] == 0 ){ + $dsn = "mysql:dbname={$dbConfig['DB_NAME']};host={$dbConfig['DB_HOST']};port={$dbConfig['DB_PORT']}"; + try { + new \PDO($dsn, $dbConfig['DB_USER'], $dbConfig['DB_PWD']); + } catch (\PDOException $e) { + $this->error($e->getMessage(), url('step2')); + } + } + //检测Redis链接状态 + if( $cacheConfig['type'] == 1 ){ + try { + (new \Redis())->connect($cacheConfig['ip'],$cacheConfig['port']); + } catch (\RedisException $e) { + $this->error($e->getMessage(), url('step2')); + } + } return $this->fetch(); } diff --git a/application/install/view/index/step3.html b/application/install/view/index/step3.html index 831a54a..794ecb9 100644 --- a/application/install/view/index/step3.html +++ b/application/install/view/index/step3.html @@ -102,10 +102,8 @@ {/volist} -
- 下一步 + 下一步 上一步 -
{/block} \ No newline at end of file