Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
webman-blog
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
魏洲
webman-blog
Commits
fad86132
Commit
fad86132
authored
Aug 30, 2022
by
wolfcode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug
parent
0803a1fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
InstallCheck.php
app/middleware/InstallCheck.php
+8
-2
sqldata.sql
extend/sqldata.sql
+1
-1
No files found.
app/middleware/InstallCheck.php
View file @
fad86132
...
...
@@ -51,15 +51,21 @@ class InstallCheck implements MiddlewareInterface
$conn
=
mysqli_connect
(
$dbHost
,
$dbUser
,
$dbPwd
,
null
,
$dbPort
);
mysqli_query
(
$conn
,
"SET NAMES
{
$dbCharset
}
"
);
try
{
mysqli_select_db
(
$conn
,
$dbName
);
if
(
!
mysqli_select_db
(
$conn
,
$dbName
))
{
if
(
!
mysqli_query
(
$conn
,
"CREATE DATABASE IF NOT EXISTS `
{
$dbName
}
` DEFAULT CHARACTER SET
{
$dbCharset
}
;"
))
{
$errorMsg
=
"数据库
{
$dbName
}
不存在,也没权限创建新的数据库!"
;
mysqli_close
(
$conn
);
return
response
(
$errorMsg
,
400
);
}
}
}
catch
(
\mysqli_sql_exception
$exception
)
{
if
(
!
mysqli_query
(
$conn
,
"CREATE DATABASE IF NOT EXISTS `
{
$dbName
}
` DEFAULT CHARACTER SET
{
$dbCharset
}
;"
))
{
$errorMsg
=
"数据库
{
$dbName
}
不存在,也没权限创建新的数据库!"
;
mysqli_close
(
$conn
);
return
response
(
$errorMsg
,
400
);
}
mysqli_select_db
(
$conn
,
$dbName
);
}
mysqli_select_db
(
$conn
,
$dbName
);
// 先建表
$db_data
=
file_get_contents
(
$db_base_data
);
$sqlFormat
=
sql_split
(
$db_data
);
...
...
extend/sqldata.sql
View file @
fad86132
...
...
@@ -8,4 +8,4 @@ INSERT INTO `category` VALUES (2, '技术', 1, '2022-04-16 20:54:11', NULL, 0);
INSERT
INTO
`category`
VALUES
(
3
,
'折腾'
,
1
,
'2022-04-16 20:54:11'
,
NULL
,
0
);
INSERT
INTO
`article`
VALUES
(
1
,
'蒹葭'
,
'蒹葭苍苍,白露为霜。所谓伊人,在水一方。溯洄从之,道阻且长。溯游从之,宛在水中央。
\n
蒹葭萋萋,白露未晞。所谓伊人,在水之湄。溯洄从之,道阻且跻。溯游从之,宛在水中坻。
\n
蒹葭采采,白露未已。所谓伊人,在'
,
1
,
'/upload/20220517/dip1652765664FSjzHW.jpg'
,
'蒹葭苍苍,白露为霜。所谓伊人,在水一方。溯洄从之,道阻且长。溯游从之,宛在水中央。<br>
\n
蒹葭萋萋,白露未晞。所谓伊人,在水之湄。溯洄从之,道阻且跻。溯游从之,宛在水中坻。<br>
\n
蒹葭采采,白露未已。所谓伊人,在水之涘。溯洄从之,道阻且右。溯游从之,宛在水中沚。<br>'
,
'2022-05-08'
,
11
,
1
,
0
,
'2022-05-08 15:55:46'
,
'2022-05-17 13:34:29'
);
INSERT
INTO
`article`
VALUES
(
2
,
'我承认我找不到素材了'
,
'那就这样吧!
\n\n\n\n
'
,
3
,
''
,
'那就这样吧!
\n
<div><br>
\n
</div>
\n
<div align=
\"
center
\"
><img src=
\"
/upload/20220517/Hkb1652765942zWOqaJ.jpg
\"
><br>
\n
</div>'
,
'2022-05-17'
,
11
,
1
,
0
,
'2022-05-17 13:39:04'
,
'2022-05-17 13:41:21'
);
INSERT
INTO
`banner`
VALUES
(
1
,
'轮播图可以后台设置'
,
''
,
0
,
''
,
'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic1.win4000.com%2Fwallpaper%2F2020-03-16%2F5e6f456284b3e.jpg&refer=http%3A%2F%2Fpic1.win4000.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1664443024&t=56aed7f75b80334354600cd8556d093c'
,
1
,
NULL
,
NULL
,
1
);
\ No newline at end of file
INSERT
INTO
`banner`
VALUES
(
1
,
'轮播图可以后台设置'
,
'/info/2/'
,
1
,
''
,
'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic1.win4000.com%2Fwallpaper%2F2020-03-16%2F5e6f456284b3e.jpg&refer=http%3A%2F%2Fpic1.win4000.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1664443024&t=56aed7f75b80334354600cd8556d093c'
,
1
,
NULL
,
NULL
,
1
);
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment