Fix use SQLite error of windows install (#1471)

This commit is contained in:
沈唁 2022-07-20 00:20:25 +08:00 committed by GitHub
parent f07b57fe20
commit d15fc14463
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1022,7 +1022,12 @@ function install_step_2_perform()
$error = (new \Typecho\Validate())
->addRule('dbFile', 'required', _t('确认您的配置'))
->addRule('dbFile', function (string $path) {
return !!preg_match("/^(\/[._a-z0-9-]+)*[a-z0-9]+\.[a-z0-9]{2,}$/i", $path);
$pattern = "/^(\/[._a-z0-9-]+)*[a-z0-9]+\.[a-z0-9]{2,}$/i";
if (strstr(PHP_OS, 'WIN'))
{
$pattern = "/(\/[._a-z0-9-]+)*[a-z0-9]+\.[a-z0-9]{2,}$/i";
}
return !!preg_match($pattern, $path);
}, _t('确认您的配置'))
->run($config);
break;