humhub/index.php
Gevorg Mansuryan 1ac3c9af2b
Refactor application state mechanism (#7361)
* Check Codeceptions Tests
#473

* Check Codeceptions Tests
#473

* Check Codeceptions Tests
#473

* Check Codeceptions Tests
#473

* Check Codeceptions Tests
#473

* Check Codeceptions Tests
#473

* Refactor applicationState mechanism

* Refactor applicationState mechanism

* Refactor applicationState mechanism

* Refactor applicationState mechanism

* Autocommit PHP CS Fixer

* Refactor applicationState mechanism

* Refactor applicationState mechanism

* Refactor applicationState mechanism

* Refactor applicationState mechanism

* Refactor applicationState mechanism

* Refactor applicationState mechanism

* Refactor applicationState mechanism

* Refactor applicationState mechanism

* Refactor applicationState mechanism

* Refactor applicationState mechanism

* Refactor applicationState mechanism

* Refactor applicationState mechanism

* Refactor applicationState mechanism

* Refactor applicationState mechanism

* Refactor applicationState mechanism - fixes

* Refactor applicationState mechanism - fixes

* Refactor applicationState mechanism - fixes

* Revert "Refactor applicationState mechanism"

This reverts commit 9ffd3243bfb7630a69363e9a4b1d3c46c00a3ecc.

* Refactor applicationState mechanism - fixes

* Revert "Refactor applicationState mechanism"

This reverts commit 0694c84e2462f6cc155816600f42e11e939b95d7.

* Refactor applicationState mechanism - fixes

* Refactor applicationState mechanism - fixes

* Refactor applicationState mechanism - fixes/revert

* Refactoring (#7372)

* Fix Test

* Refactor application state mechanism - fixes

* Revert "Refactoring (#7372)"

This reverts commit ce1b39c3

* Refactor application state mechanism - fixes

* Refactor application state mechanism - fix tests

* Refactor application state mechanism - fix tests

* Refactor application state mechanism - fixes

* Refactor application state mechanism - fixes

* Refactor application state mechanism - fixes

* Refactor application state mechanism - fixes

* Refactor application state mechanism - fixes

* Refactor application state mechanism - fixes

* Make SetState private

---------

Co-authored-by: gevorgmansuryan <gevorgmansuryan@users.noreply.github.com>
Co-authored-by: Lucas Bartholemy <luke-@users.noreply.github.com>
Co-authored-by: Lucas Bartholemy <lucas@bartholemy.com>
2025-02-26 10:52:57 +01:00

39 lines
1.3 KiB
PHP

<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
require(__DIR__ . '/protected/vendor/autoload.php');
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__, '.env');
$dotenv->safeLoad();
$dynamicConfig = (is_readable(__DIR__ . '/protected/config/dynamic.php')) ? require(__DIR__ . '/protected/config/dynamic.php') : [];
$debug = filter_var($_ENV['HUMHUB_DEBUG'] ?? false, FILTER_VALIDATE_BOOLEAN) || !filter_var($dynamicConfig['params']['installed'] ?? false, FILTER_VALIDATE_BOOLEAN);
defined('YII_DEBUG') or define('YII_DEBUG', $debug);
defined('YII_ENV') or define('YII_ENV', $debug ? 'dev' : 'prod');
require(__DIR__ . '/protected/vendor/yiisoft/yii2/Yii.php');
$config = yii\helpers\ArrayHelper::merge(
require(__DIR__ . '/protected/humhub/config/common.php'),
require(__DIR__ . '/protected/humhub/config/web.php'),
require(__DIR__ . '/protected/config/common.php'),
require(__DIR__ . '/protected/config/web.php'),
$dynamicConfig,
humhub\helpers\EnvHelper::toConfig($_ENV, \humhub\components\Application::class),
);
try {
(new humhub\components\Application($config))->run();
} catch (Throwable $e) {
if (null === humhub\helpers\DatabaseHelper::handleConnectionErrors($e)) {
throw $e;
}
}