instances added god may help

This commit is contained in:
2026-02-23 12:58:19 +01:00
parent 25370a1a55
commit 99db252f60
290 changed files with 9858 additions and 4914 deletions

View File

@@ -1,17 +1,18 @@
<?php
use MintyPHP\Firewall;
use MintyPHP\Session;
use MintyPHP\Debugger;
use MintyPHP\Analyzer;
use MintyPHP\Router;
use MintyPHP\DB;
use MintyPHP\Buffer;
use MintyPHP\I18n;
use MintyPHP\Http\Request;
use MintyPHP\Http\LocaleResolver;
use MintyPHP\DB;
use MintyPHP\Debugger;
use MintyPHP\Firewall;
use MintyPHP\Http\AccessControl;
use MintyPHP\Http\AssetDetector;
use MintyPHP\Http\LocaleResolver;
use MintyPHP\Http\Request;
use MintyPHP\I18n;
use MintyPHP\Router;
use MintyPHP\Service\Auth\AuthServicesFactory;
use MintyPHP\Session;
use MintyPHP\Support\Flash;
// Change directory to project root
@@ -30,6 +31,9 @@ Firewall::start();
// Start the session
Session::start();
$authServicesFactory = new AuthServicesFactory();
$authService = $authServicesFactory->createAuthService();
$rememberMeService = $authServicesFactory->createRememberMeService();
// Initialize default locale from tenant/app settings
$defaultLocale = appDefaultLocale();
@@ -42,7 +46,7 @@ if ($defaultLocale !== null) {
// Auto-login from remember-me cookie
if (empty($_SESSION['user']['id'])) {
\MintyPHP\Service\Auth\RememberMeService::autoLoginFromCookie();
$rememberMeService->autoLoginFromCookie();
}
// Parse request URI and resolve locale
@@ -92,9 +96,9 @@ if ($isApiRequest) {
if (!empty($_SESSION['user']['id']) && !$isAssetRequest && !$isApiRequest) {
$userId = (int) ($_SESSION['user']['id'] ?? 0);
if ($userId > 0) {
$authState = \MintyPHP\Service\Auth\AuthService::refreshSessionAuthState($userId);
$authState = $authService->refreshSessionAuthState($userId);
if (!empty($authState['logout_required'])) {
\MintyPHP\Service\Auth\AuthService::logout();
$authService->logout();
$reason = (string) ($authState['reason'] ?? '');
if ($reason === 'inactive') {
Flash::error(t('Account is inactive'), 'login', 'login_inactive');
@@ -111,7 +115,7 @@ if (!empty($_SESSION['user']['id']) && !$isAssetRequest && !$isApiRequest) {
$needsRefresh = true;
}
if ($needsRefresh) {
\MintyPHP\Service\Auth\AuthService::loadTenantDataIntoSession($userId);
$authService->loadTenantDataIntoSession($userId);
$_SESSION['tenant_snapshot_at'] = time();
}
}