166 $this->sessionLocalStorageManager =
new Data\LocalStorage\SessionLocalStorageManager($localSessionStorage);
228 $routingConfig = Configuration::getInstance()->get(
'routing');
229 $documentRoot = $this->context->getServer()->getDocumentRoot();
231 if (!empty($routingConfig[
'config']))
233 $fileNames = $routingConfig[
'config'];
235 foreach ($fileNames as $fileName)
237 foreach ([
'local',
'bitrix'] as $vendor)
239 $filename = $documentRoot .
'/' . $vendor .
'/routes/' . basename($fileName);
241 if (file_exists($filename))
243 $files[] = $filename;
250 if (file_exists($documentRoot .
'/bitrix/routes/web_bitrix.php'))
252 $files[] = $documentRoot .
'/bitrix/routes/web_bitrix.php';
255 foreach ($files as $file)
257 $callback = include $file;
417 $exceptionHandling = Config\Configuration::getValue(
"exception_handling");
418 if ($exceptionHandling ==
null)
420 $exceptionHandling = [];
423 if (!isset($exceptionHandling[
"debug"]) || !is_bool($exceptionHandling[
"debug"]))
425 $exceptionHandling[
"debug"] =
false;
427 $exceptionHandler->setDebugMode($exceptionHandling[
"debug"]);
429 if (!empty($exceptionHandling[
'track_modules']) && is_array($exceptionHandling[
'track_modules']))
431 $exceptionHandler->setTrackModules($exceptionHandling[
'track_modules']);
434 if (isset($exceptionHandling[
"handled_errors_types"]) && is_int($exceptionHandling[
"handled_errors_types"]))
436 $exceptionHandler->setHandledErrorsTypes($exceptionHandling[
"handled_errors_types"]);
439 if (isset($exceptionHandling[
"exception_errors_types"]) && is_int($exceptionHandling[
"exception_errors_types"]))
441 $exceptionHandler->setExceptionErrorsTypes($exceptionHandling[
"exception_errors_types"]);
444 if (isset($exceptionHandling[
"ignore_silence"]) && is_bool($exceptionHandling[
"ignore_silence"]))
446 $exceptionHandler->setIgnoreSilence($exceptionHandling[
"ignore_silence"]);
449 if (isset($exceptionHandling[
"assertion_throws_exception"]) && is_bool($exceptionHandling[
"assertion_throws_exception"]))
451 $exceptionHandler->setAssertionThrowsException($exceptionHandling[
"assertion_throws_exception"]);
454 if (isset($exceptionHandling[
"assertion_error_type"]) && is_int($exceptionHandling[
"assertion_error_type"]))
456 $exceptionHandler->setAssertionErrorType($exceptionHandling[
"assertion_error_type"]);
459 $exceptionHandler->initialize(
460 [$this,
"createExceptionHandlerOutput"],
461 [$this,
"createExceptionHandlerLog"]
464 ServiceLocator::getInstance()->addInstance(
'exceptionHandler', $exceptionHandler);
469 $exceptionHandling = Config\Configuration::getValue(
"exception_handling");
471 if (!is_array($exceptionHandling) || !isset($exceptionHandling[
"log"]) || !is_array($exceptionHandling[
"log"]))
476 $options = $exceptionHandling[
"log"];
480 if (!empty($options[
"class_name"]))
482 if (!empty($options[
"extension"]) && !extension_loaded($options[
"extension"]))
487 if (!empty($options[
"required_file"]) && ($requiredFile =
Loader::getLocal($options[
"required_file"])) !==
false)
489 require_once($requiredFile);
492 $className = $options[
"class_name"];
493 if (!class_exists($className))
498 $log =
new $className();
500 elseif (isset($options[
"settings"]) && is_array($options[
"settings"]))
510 isset($options[
"settings"]) && is_array($options[
"settings"]) ? $options[
"settings"] : []
533 $show_cache_stat =
"";
534 if (isset($_GET[
"show_cache_stat"]))
536 $show_cache_stat = (strtoupper($_GET[
"show_cache_stat"]) ==
"Y" ?
"Y" :
"");
537 @setcookie(
"show_cache_stat", $show_cache_stat,
false,
"/");
539 elseif (isset($_COOKIE[
"show_cache_stat"]))
541 $show_cache_stat = $_COOKIE[
"show_cache_stat"];
543 Data\Cache::setShowCacheStat($show_cache_stat ===
"Y");
545 if (isset($_GET[
"clear_cache_session"]))
547 Data\Cache::setClearCacheSession($_GET[
"clear_cache_session"] ===
'Y');
549 if (isset($_GET[
"clear_cache"]))
551 Data\Cache::setClearCache($_GET[
"clear_cache"] ===
'Y');
812 $lastException =
null;
816 while ($this->backgroundJobs->valid())
820 foreach ($this->backgroundJobs as $job)
826 foreach ($jobs as $job)
830 call_user_func_array($job[0], $job[1]);
832 catch (\Throwable $exception)
834 $lastException = $exception;
835 $exceptionHandler->writeToLog($exception);
840 if ($lastException !==
null)
842 throw $lastException;