🔧 去除 mysqli 安装条件, 换成 PDO

This commit is contained in:
WispX 2020-03-18 09:43:55 +08:00
parent 629078637b
commit 338ef83f73
5 changed files with 17 additions and 15 deletions

View File

@ -42,7 +42,7 @@
### 🛠 安装要求
* PHP 版本 ≥ 5.6(≤ 7.3)
* mysql 版本 ≥ 5.5
* mysqli 支持
* PDO 拓展
* ZipArchive 支持
* fileinfo 拓展
* curl 拓展

View File

@ -18,14 +18,14 @@ class Initialize
if ($request->controller(true) !== 'install' || $request->action(true) !== 'index') {
return redirect(url('install/index'));
}
}
// 检测封禁IP
$banIp = $this->getConfig('ban_ip');
if ($banIp) {
$ips = explode(',', str_replace('', ',', $banIp));
if (in_array($request->ip(), $ips)) {
throw new HttpResponseException(Response::code(403));
} else {
// 检测封禁IP
$banIp = $this->getConfig('ban_ip');
if ($banIp) {
$ips = explode(',', str_replace('', ',', $banIp));
if (in_array($request->ip(), $ips)) {
throw new HttpResponseException(Response::code(403));
}
}
}

View File

@ -31,7 +31,9 @@ class WebAuthenticate
$user = null;
if ($uid = Session::get('uid')) {
$user = Users::get($uid);
if (!$user = Users::get($uid)) {
Session::delete('uid');
}
}
if (!in_array($path, $this->paths) && !$user) {

View File

@ -25,18 +25,18 @@ class Install extends Controller
$phpVerGt56 = PHP_VERSION >= 5.6;
$isCurl = function_exists('curl_init');
$isFileInfo = function_exists('finfo_open');
$isMysqli = class_exists('mysqli');
$pdo = extension_loaded("pdo_mysql");
$isZip = class_exists('ZipArchive');
switch ($step) {
case 1:
// 运行环境检测
$testing = $phpVerGt56 && $isCurl && $isFileInfo && $isMysqli && $isZip;
$testing = $phpVerGt56 && $isCurl && $isFileInfo && $pdo && $isZip;
$this->assign([
'phpVerGt56' => $phpVerGt56,
'isCurl' => $isCurl,
'isFileInfo' => $isFileInfo,
'isMysqli' => $isMysqli,
'pdo' => $pdo,
'isZip' => $isZip,
'testing' => $testing,
'dir' => is_writable(app()->getRuntimePath()) && is_writable(app()->getConfigPath()),

View File

@ -76,10 +76,10 @@
</tr>
<tr>
<td align="right">
mysqli
PDO 拓展
</td>
<td align="left">
{if ($isMysqli) }
{if ($pdo) }
<i class="mdui-icon material-icons mdui-text-color-green">&#xe86c;</i>
{else/}
<i class="mdui-icon material-icons mdui-text-color-red">&#xe5c9;</i>