一键安装bug修复

This commit is contained in:
sugar1569 2019-02-14 10:12:32 +08:00
parent e059b0eebe
commit 01e4017f35
3 changed files with 176 additions and 229 deletions

File diff suppressed because one or more lines are too long

View File

@ -134,6 +134,7 @@ switch ($step) {
'runtime/cache',
'runtime/temp',
'runtime/log',
'runtime/schema',
'application/database.php',
'application/config.php',
);
@ -260,11 +261,21 @@ switch ($step) {
// 清空测试数据
if($_POST['demo'] != 'demo')
if(!$_POST['demo'])
{
$result = mysqli_query($conn,"show tables");
$tables=mysqli_fetch_all($result,MYSQLI_ASSOC);//参数MYSQL_ASSOC、MYSQLI_NUM、MYSQLI_BOTH规定产生数组类型
$bl_table = array('eb_system_config','eb_system_config_tab','eb_system_menus','eb_system_file','eb_express','eb_system_group','eb_system_group_data');
$tables=mysqli_fetch_all($result);//参数MYSQL_ASSOC、MYSQLI_NUM、MYSQLI_BOTH规定产生数组类型
$bl_table = array('eb_system_admin'
,'eb_system_role'
,'eb_system_config'
,'eb_system_config_tab'
,'eb_system_menus'
,'eb_system_file'
,'eb_express'
,'eb_system_group'
,'eb_system_group_data'
,'eb_wechat_template'
,'eb_routine_template');
foreach($bl_table as $k => $v)
{
$bl_table[$k] = str_replace('eb_',$dbPrefix,$v);

View File

@ -167,7 +167,7 @@ switch ($step) {
for ($i = $n; $i < $counts; $i++) {
$sql = trim($sqlFormat[$i]);
if (strstr($sql, 'CREATE TABLE')) {
preg_match('/CREATE TABLE IF NOT EXISTS `eb_([^ ]*)`/is', $sql, $matches);
preg_match('/CREATE TABLE `eb_([^ ]*)`/is', $sql, $matches);
mysqli_query($conn,"DROP TABLE IF EXISTS `$matches[1]");
$sql = str_replace('`eb_','`'.$dbPrefix,$sql);//替换表前缀
$ret = mysqli_query($conn,$sql);