Skip to content

Commit

Permalink
debug conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
phphleb committed Dec 22, 2024
1 parent f53f47b commit ba7e4b7
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions Main/ProjectLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Hleb\Helpers\ReflectionMethod;
use Hleb\Helpers\RouteHelper;
use Hleb\HttpException;
use Hleb\HttpMethods\External\SystemRequest;
use Hleb\HttpMethods\Intelligence\Cookies\AsyncCookies;
use Hleb\Main\Routes\Search\RouteAsyncFileManager;
use \Hleb\Static\Csrf;
Expand Down Expand Up @@ -65,9 +66,7 @@ public static function init(): void
}
/** @see hl_check() - searchHeadMethod completed */

if ($routes->getIsNoDebug()) {
DynamicParams::setDynamicDebug(false);
}
self::checkIsNoDebug($routes, DynamicParams::getRequest());

if ($block) {
if (self::searchDefaultHttpOptionsMethod($block)) {
Expand Down Expand Up @@ -296,7 +295,7 @@ private static function initSession(bool|null $disabledInRoute): void
}
StandardCookies::sync();
} else {
AsyncConsolidator::initAsyncSessionAndCookies();
AsyncConsolidator::initAsyncSessionAndCookies();
}
if (\session_status() !== PHP_SESSION_ACTIVE) {
throw new CoreProcessException('SESSION not initialized!');
Expand Down Expand Up @@ -537,4 +536,18 @@ protected static function runKernelEventAndExit(): bool
}
return false;
}

/**
* Makes adjustments to debug mode activity for certain conditions.
*
* Вносит поправки в активность режима отладки для определенных условий.
*/
protected static function checkIsNoDebug(RouteFileManager $routes, SystemRequest $request): void
{
if ($routes->getIsNoDebug() &&
($request->getGetParam('_debug') ?? $request->getPostParam('_debug')) !== 'on'
) {
DynamicParams::setDynamicDebug(false);
}
}
}

0 comments on commit ba7e4b7

Please sign in to comment.