enhance performance at installation
This commit is contained in:
parent
38d7808dfa
commit
22be48c309
|
|
@ -50,10 +50,10 @@ class Boot
|
||||||
Config::checkCache();
|
Config::checkCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function checkInstallation()
|
public static function checkInstallation($redirect_to = '../setup/index.php')
|
||||||
{
|
{
|
||||||
if (!Config::checkTableExist()) {
|
if (!Config::checkTableExist()) {
|
||||||
Http::redirect('../setup/index.php');
|
Http::redirect($redirect_to);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_dir(BASE_DIR.'/textures/')) {
|
if (!is_dir(BASE_DIR.'/textures/')) {
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ switch ($step) {
|
||||||
$sitename = isset($_POST['sitename']) ? $_POST['sitename'] : "Blessing Skin Server";
|
$sitename = isset($_POST['sitename']) ? $_POST['sitename'] : "Blessing Skin Server";
|
||||||
|
|
||||||
if (Validate::email($email)) {
|
if (Validate::email($email)) {
|
||||||
if (!Validate::password($password)) {
|
if (!Validate::password($password, true)) {
|
||||||
Http::redirect('index.php?step=2', '无效的密码。密码长度应该大于 8 并小于 16。');
|
Http::redirect('index.php?step=2', '无效的密码。密码长度应该大于 8 并小于 16。');
|
||||||
|
|
||||||
} else if (Utils::convertString($password) != $password) {
|
} else if (Utils::convertString($password) != $password) {
|
||||||
|
|
@ -75,9 +75,10 @@ switch ($step) {
|
||||||
|
|
||||||
// import options
|
// import options
|
||||||
$options = require "options.php";
|
$options = require "options.php";
|
||||||
$options['site_name'] = $_POST['sitename'];
|
$options['site_name'] = $_POST['sitename'];
|
||||||
$options['site_url'] = Http::getBaseUrl();
|
$options['site_url'] = Http::getBaseUrl();
|
||||||
$options['version'] = App::getVersion();
|
$options['version'] = App::getVersion();
|
||||||
|
$options['announcement'] = str_replace('{version}', $options['version'], $options['announcement']);
|
||||||
|
|
||||||
foreach ($options as $key => $value) {
|
foreach ($options as $key => $value) {
|
||||||
Option::add($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']);
|
echo View::make('setup.steps.3')->with('email', $_POST['email'])->with('password', $_POST['password']);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new App\Exceptions\E('非法参数', 1, true);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,8 @@ if (Config::checkDbConfig($db_config)) {
|
||||||
Boot::bootEloquent($db_config);
|
Boot::bootEloquent($db_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Boot::checkInstallation('../../setup/index.php');
|
||||||
|
|
||||||
if (isset($_COOKIE['email']) && isset($_COOKIE['token'])) {
|
if (isset($_COOKIE['email']) && isset($_COOKIE['token'])) {
|
||||||
$_SESSION['email'] = $_COOKIE['email'];
|
$_SESSION['email'] = $_COOKIE['email'];
|
||||||
$_SESSION['token'] = $_COOKIE['token'];
|
$_SESSION['token'] = $_COOKIE['token'];
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
* @Author: printempw
|
* @Author: printempw
|
||||||
* @Date: 2016-07-29 11:53:11
|
* @Date: 2016-07-29 11:53:11
|
||||||
* @Last Modified by: printempw
|
* @Last Modified by: printempw
|
||||||
* @Last Modified time: 2016-08-08 22:41:23
|
* @Last Modified time: 2016-08-10 22:11:03
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
@ -13,10 +13,9 @@ return [
|
||||||
'user_can_register' => '1',
|
'user_can_register' => '1',
|
||||||
'regs_per_ip' => '3',
|
'regs_per_ip' => '3',
|
||||||
'api_type' => '0',
|
'api_type' => '0',
|
||||||
'announcement' => '欢迎使用 Blessing Skin Server 3.0!',
|
'announcement' => '欢迎使用 Blessing Skin Server {version}!',
|
||||||
'color_scheme' => 'skin-blue',
|
'color_scheme' => 'skin-blue',
|
||||||
'home_pic_url' => './assets/images/bg.jpg',
|
'home_pic_url' => './assets/images/bg.jpg',
|
||||||
'current_version' => '3.0-beta',
|
|
||||||
'custom_css' => '',
|
'custom_css' => '',
|
||||||
'custom_js' => '',
|
'custom_js' => '',
|
||||||
'update_url' => 'https://work.prinzeugen.net/update.json',
|
'update_url' => 'https://work.prinzeugen.net/update.json',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user