mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-12-15 06:09:58 +08:00
move boot procedure to Boot class
This commit is contained in:
parent
88f1ca4f23
commit
ab472d8fd2
@ -38,7 +38,7 @@ class AdminController extends BaseController
|
||||
public function update()
|
||||
{
|
||||
if (\Utils::getValue('action', $_GET) == "check") {
|
||||
$updater = new \Updater(\Application::getVersion());
|
||||
$updater = new \Updater(\App::getVersion());
|
||||
if ($updater->newVersionAvailable()) {
|
||||
View::json([
|
||||
'new_version_available' => true,
|
||||
|
@ -4,13 +4,6 @@ namespace App\Services;
|
||||
|
||||
class Application
|
||||
{
|
||||
protected $base_dir;
|
||||
|
||||
public function __construct($dir)
|
||||
{
|
||||
$this->base_dir = $dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start Application
|
||||
*
|
||||
@ -18,34 +11,18 @@ class Application
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// Load Aliases
|
||||
Boot::loadServices();
|
||||
|
||||
// Check Runtime Environment
|
||||
Boot::checkRuntimeEnv();
|
||||
|
||||
// Load dotenv Configuration
|
||||
Boot::loadDotEnv($this->base_dir);
|
||||
|
||||
// Register Error Handler
|
||||
Boot::registerErrorHandler();
|
||||
|
||||
// Boot Eloquent ORM
|
||||
Boot::bootEloquent(Config::getDbConfig());
|
||||
|
||||
// Redirect if not installed
|
||||
Boot::checkInstallation();
|
||||
|
||||
// Start Session
|
||||
Boot::startSession();
|
||||
|
||||
// Start Route Dispatching
|
||||
Boot::bootRouter();
|
||||
Boot::start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current app version
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getVersion()
|
||||
{
|
||||
$config = require BASE_DIR."/config/app.php";
|
||||
return $config['version'];
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,6 +9,33 @@ use App\Exceptions\E;
|
||||
|
||||
class Boot
|
||||
{
|
||||
public static function start()
|
||||
{
|
||||
// Load Aliases
|
||||
self::loadServices();
|
||||
|
||||
// Check Runtime Environment
|
||||
self::checkRuntimeEnv();
|
||||
|
||||
// Load dotenv Configuration
|
||||
self::loadDotEnv(BASE_DIR);
|
||||
|
||||
// Register Error Handler
|
||||
self::registerErrorHandler();
|
||||
|
||||
// Boot Eloquent ORM
|
||||
self::bootEloquent(Config::getDbConfig());
|
||||
|
||||
// Redirect if not installed
|
||||
self::checkInstallation();
|
||||
|
||||
// Start Session
|
||||
self::startSession();
|
||||
|
||||
// Start Route Dispatching
|
||||
self::bootRouter();
|
||||
}
|
||||
|
||||
public static function loadDotEnv($dir)
|
||||
{
|
||||
if (Config::checkDotEnvExist()) {
|
||||
|
@ -9,20 +9,21 @@
|
||||
| the aliases are "lazy" loaded so they don't hinder performance.
|
||||
|
|
||||
*/
|
||||
|
||||
return [
|
||||
'View' => 'App\Services\View',
|
||||
'Database' => 'App\Services\Database',
|
||||
'Option' => 'App\Services\Option',
|
||||
'Utils' => 'App\Services\Utils',
|
||||
'Validate' => 'App\Services\Validate',
|
||||
'Http' => 'App\Services\Http',
|
||||
'Mail' => 'App\Services\Mail',
|
||||
'Storage' => 'App\Services\Storage',
|
||||
'Minecraft' => 'App\Services\Minecraft',
|
||||
'Updater' => 'App\Services\Updater',
|
||||
'Config' => 'App\Services\Config',
|
||||
'Schema' => 'App\Services\Schema',
|
||||
'Boot' => 'App\Services\Boot',
|
||||
'Migration' => 'App\Services\Migration',
|
||||
'Application' => 'App\Services\Application'
|
||||
'View' => 'App\Services\View',
|
||||
'Database' => 'App\Services\Database',
|
||||
'Option' => 'App\Services\Option',
|
||||
'Utils' => 'App\Services\Utils',
|
||||
'Validate' => 'App\Services\Validate',
|
||||
'Http' => 'App\Services\Http',
|
||||
'Mail' => 'App\Services\Mail',
|
||||
'Storage' => 'App\Services\Storage',
|
||||
'Minecraft' => 'App\Services\Minecraft',
|
||||
'Updater' => 'App\Services\Updater',
|
||||
'Config' => 'App\Services\Config',
|
||||
'Schema' => 'App\Services\Schema',
|
||||
'Boot' => 'App\Services\Boot',
|
||||
'Migration' => 'App\Services\Migration',
|
||||
'App' => 'App\Services\Application'
|
||||
];
|
||||
|
Loading…
Reference in New Issue
Block a user