enhance performance at installation

This commit is contained in:
printempw 2016-08-10 22:22:28 +08:00
parent 38d7808dfa
commit 22be48c309
4 changed files with 15 additions and 9 deletions

View File

@ -50,10 +50,10 @@ class Boot
Config::checkCache();
}
public static function checkInstallation()
public static function checkInstallation($redirect_to = '../setup/index.php')
{
if (!Config::checkTableExist()) {
Http::redirect('../setup/index.php');
Http::redirect($redirect_to);
}
if (!is_dir(BASE_DIR.'/textures/')) {

View File

@ -56,7 +56,7 @@ switch ($step) {
$sitename = isset($_POST['sitename']) ? $_POST['sitename'] : "Blessing Skin Server";
if (Validate::email($email)) {
if (!Validate::password($password)) {
if (!Validate::password($password, true)) {
Http::redirect('index.php?step=2', '无效的密码。密码长度应该大于 8 并小于 16。');
} else if (Utils::convertString($password) != $password) {
@ -75,9 +75,10 @@ switch ($step) {
// import options
$options = require "options.php";
$options['site_name'] = $_POST['sitename'];
$options['site_url'] = Http::getBaseUrl();
$options['version'] = App::getVersion();
$options['site_name'] = $_POST['sitename'];
$options['site_url'] = Http::getBaseUrl();
$options['version'] = App::getVersion();
$options['announcement'] = str_replace('{version}', $options['version'], $options['announcement']);
foreach ($options as $key => $value) {
Option::add($key, $value);
@ -96,4 +97,8 @@ switch ($step) {
echo View::make('setup.steps.3')->with('email', $_POST['email'])->with('password', $_POST['password']);
break;
default:
throw new App\Exceptions\E('非法参数', 1, true);
break;
}

View File

@ -23,6 +23,8 @@ if (Config::checkDbConfig($db_config)) {
Boot::bootEloquent($db_config);
}
Boot::checkInstallation('../../setup/index.php');
if (isset($_COOKIE['email']) && isset($_COOKIE['token'])) {
$_SESSION['email'] = $_COOKIE['email'];
$_SESSION['token'] = $_COOKIE['token'];

View File

@ -3,7 +3,7 @@
* @Author: printempw
* @Date: 2016-07-29 11:53:11
* @Last Modified by: printempw
* @Last Modified time: 2016-08-08 22:41:23
* @Last Modified time: 2016-08-10 22:11:03
*/
return [
@ -13,10 +13,9 @@ return [
'user_can_register' => '1',
'regs_per_ip' => '3',
'api_type' => '0',
'announcement' => '欢迎使用 Blessing Skin Server 3.0',
'announcement' => '欢迎使用 Blessing Skin Server {version}',
'color_scheme' => 'skin-blue',
'home_pic_url' => './assets/images/bg.jpg',
'current_version' => '3.0-beta',
'custom_css' => '',
'custom_js' => '',
'update_url' => 'https://work.prinzeugen.net/update.json',