Skip to content

Commit

Permalink
Add a prompt message for manual database creation (#1348)
Browse files Browse the repository at this point in the history
* Optimize for no database during install

* change tips
  • Loading branch information
sy-records committed May 16, 2023
1 parent 596d117 commit c725fec
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion install.php
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,12 @@ function install_step_2_perform()
$installDb->addServer($dbConfig, \Typecho\Db::READ | \Typecho\Db::WRITE);
$installDb->query('SELECT 1=1');
} catch (\Typecho\Db\Adapter\ConnectionException $e) {
install_raise_error(_t('对不起, 无法连接数据库, 请先检查数据库配置再继续进行安装: "%s"', $e->getMessage()));
$code = $e->getCode();
if (('Mysql' == $type && 1049 == $code) || ('Pgsql' == $type && 7 == $code)) {
install_raise_error(_t('数据库: "%s"不存在,请手动创建后重试', $config['dbDatabase']));
} else {
install_raise_error(_t('对不起, 无法连接数据库, 请先检查数据库配置再继续进行安装: "%s"', $e->getMessage()));
}
} catch (\Typecho\Db\Exception $e) {
install_raise_error(_t('安装程序捕捉到以下错误: "%s". 程序被终止, 请检查您的配置信息.', $e->getMessage()));
}
Expand Down

0 comments on commit c725fec

Please sign in to comment.