From e10f1198110a039fdea508eafea0f9a4e8e4587a Mon Sep 17 00:00:00 2001 From: Chenx221 Date: Sat, 30 Mar 2024 13:46:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E7=AB=99=E7=82=B9=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E4=BF=A1=E6=81=AF=E5=B9=B6=E8=BF=94=E5=9B=9E=E5=88=B0?= =?UTF-8?q?=E5=89=8D=E7=AB=AF=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/AdminController.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/controllers/AdminController.php b/controllers/AdminController.php index 97e4de9..986341c 100644 --- a/controllers/AdminController.php +++ b/controllers/AdminController.php @@ -2,6 +2,7 @@ namespace app\controllers; +use app\models\SiteConfig; use app\models\User; use app\models\UserSearch; use app\utils\AdminSword; @@ -14,6 +15,7 @@ use yii\db\StaleObjectException; use yii\filters\AccessControl; use yii\filters\VerbFilter; use yii\web\Controller; +use yii\web\HttpException; use yii\web\NotFoundHttpException; use yii\web\Response; @@ -72,10 +74,17 @@ class AdminController extends Controller /** * @return string + * @throws HttpException */ public function actionSystem(): string { - return $this->render('system'); + $siteConfig = new SiteConfig(); + if(!$siteConfig->loadFromEnv()){ + throw new HttpException(500, 'Fatal error, Unable to load site configuration from .env file.'); + } + return $this->render('system',[ + 'siteConfig' => $siteConfig + ]); } /**