/** Datei: plugins/systems/hooks/config/preload-loaded.php **/ * @copyright 2025 ARUNOX * @version 1.0.0 * * @hook config::preload->loaded * @param array $REQUEST Typically contains the data provided by $_REQUEST * * @since 1.0.0 File is created */ use ARUNOX\Core\Plugins; use ARUNOX\Plugins\REST; use ARUNOX\Plugins\Users; use ARUNOX\Plugins\Systems; use ARUNOX\Database\Connections; $system = Systems\Model::getByColumn( "domain", trim( $_SERVER["HTTP_HOST"] ) ); define( "SYSTEM", $system ); Connections::connect([ "host" => DB_HOST, "dbname" => DB_NAME, "charset" => DB_CHARSET, "user" => DB_USER, "pass" => DB_PASS, ], "admin" ); if( !SYSTEM ) return; $plugins = SYSTEM->plugins; $allPlugins = ARUNOX\Core\Plugins::getAll(); $pluginDeps = []; foreach( $plugins as $current ) { if( $plugin = Plugins::get( $current->plugin ) ) { $plugin->setStatus( $current->status->getValue() ); if( $plugin->active && $plugin->dependencies ) { $pluginDeps[] = $plugin; } } unset( $allPlugins[ $current->plugin ] ); } foreach( $pluginDeps as $plugin ) { $plugin->checkDependencies(); } foreach( $allPlugins as $name => $plugin ) { ARUNOX\Plugins\Systems\Plugins\Model::save([ "plugin" => $name, "system_id" => SYSTEM->id, ]); } if( !SYSTEM->type->isTenantIsolated() ) { if( PUBLIC_SCRIPT_NAME == PUBLIC_SCRIPT_NAME_API ) { if( SYSTEM->db_status->getValue() < Systems\DBStatus::AdminMissing ) { if( SYSTEM->db_status->getValue() <= Systems\DBStatus::Failed ) { REST\Response::addNotify( "danger", "FATAL DATABASE ERROR", NULL, 0 ); } if( SYSTEM->db_status->getValue() == Systems\DBStatus::Installing ) { REST\Response::addNotify( "warning", "INSTALLING SYSTEM...", NULL, 0 ); } if( SYSTEM->db_status->getValue() == Systems\DBStatus::Maintenance ) { REST\Response::addNotify( "warning", "SYSTEM IS UNDER MAINTENANCE...", NULL, 0 ); } Users\API\v1\Controller::restConfigLogin(); REST\Response::jsonResponse( 401 )->send(); return; } } } SYSTEM->connect();