diff --git a/.gitignore b/.gitignore index f5beb752e61ef5cbc9272b1c76dacd9cd7217ea4..e27a1a8cb0043177bbc28867dea24d12480f36d0 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,7 @@ /static/js/app.js /static/js/field.js -runtime/smarty/* \ No newline at end of file +runtime/smarty/* +runtime/cache +runtime/install +runtime/logs diff --git a/controllers/home/InstallController.php b/controllers/home/InstallController.php index 58032f70f1b096197b4f2dd8d31ca824baa24f5d..73d9e3c47abaffafe90102d6fe1cef7e39a3f7ac 100644 --- a/controllers/home/InstallController.php +++ b/controllers/home/InstallController.php @@ -72,9 +72,9 @@ class InstallController extends PublicController Yii::$app->response->format = Response::FORMAT_JSON; $step2 = $request->post('Step2'); - + $dsn = empty($step2['sock']) ? "mysql:host={$step2['host']};port={$step2['port']}}" : "mysql:unix_socket={$step2['sock']}"; $db = [ - 'dsn' => "mysql:host={$step2['host']};port={$step2['port']}}", + 'dsn' => $dsn, 'username' => $step2['username'], 'password' => $step2['password'], 'charset' => 'utf8', @@ -100,7 +100,7 @@ class InstallController extends PublicController return ['status' => 'error', 'message' => "数据库 {$step2['dbname']} 创建失败,没有创建数据库权限,请手动创建数据库"]; } - $db['dsn'] = "mysql:host={$step2['host']};port={$step2['port']};dbname={$step2['dbname']}"; + $db['dsn'] = "$dsn;dbname={$step2['dbname']}"; $db['tablePrefix'] = $step2['prefix']; $db = ['class' => 'yii\db\Connection'] + $db; diff --git a/views/install/step2.html b/views/install/step2.html index f009ca48a702e3718127521477bc58fb269dd9c3..d6aab87b9a61543c597b4190cb9eb9908d43a53b 100644 --- a/views/install/step2.html +++ b/views/install/step2.html @@ -38,6 +38,13 @@ +