diff --git a/application/startup.inc.php b/application/startup.inc.php index ce83bf8ce..7bb5f0532 100644 --- a/application/startup.inc.php +++ b/application/startup.inc.php @@ -72,9 +72,6 @@ $oKPI = new ExecutionKPI(); Session::Start(); $oKPI->ComputeAndReport("Session Start"); -EventService::InitService(); -EventService::FireEvent(new EventData(ApplicationEvents::APPLICATION_EVENT_REQUEST_RECEIVED)); - $sSwitchEnv = utils::ReadParam('switch_env', null); $bAllowCache = true; if (($sSwitchEnv != null) && file_exists(APPCONF.$sSwitchEnv.'/'.ITOP_CONFIG_FILE) &&( Session::Get('itop_env') !== $sSwitchEnv)) @@ -106,4 +103,6 @@ else } $sConfigFile = APPCONF.$sEnv.'/'.ITOP_CONFIG_FILE; MetaModel::Startup($sConfigFile, false /* $bModelOnly */, $bAllowCache, false /* $bTraceSourceFiles */, $sEnv); +// Event service must be initialized after the MetaModel startup, otherwise it cannot discover classes implementing the iEventServiceSetup interface +EventService::InitService(); EventService::FireEvent(new EventData(ApplicationEvents::APPLICATION_EVENT_METAMODEL_STARTED)); diff --git a/sources/Application/ApplicationEvents.php b/sources/Application/ApplicationEvents.php index b2872a24b..b30fdcbbe 100644 --- a/sources/Application/ApplicationEvents.php +++ b/sources/Application/ApplicationEvents.php @@ -13,7 +13,6 @@ use Combodo\iTop\Service\Events\iEventServiceSetup; class ApplicationEvents implements iEventServiceSetup { // Startup events - const APPLICATION_EVENT_REQUEST_RECEIVED = 'APPLICATION_EVENT_REQUEST_RECEIVED'; const APPLICATION_EVENT_METAMODEL_STARTED = 'APPLICATION_EVENT_METAMODEL_STARTED'; /** @@ -21,13 +20,6 @@ class ApplicationEvents implements iEventServiceSetup */ public function RegisterEventsAndListeners() { - EventService::RegisterEvent(new EventDescription( - self::APPLICATION_EVENT_REQUEST_RECEIVED, - null, - 'A request was received from the network, at this point only the session is started, the configuration is not even loaded', - '', - [], - 'application')); EventService::RegisterEvent(new EventDescription( self::APPLICATION_EVENT_METAMODEL_STARTED, null, diff --git a/sources/Application/Service/Events/EventService.php b/sources/Application/Service/Events/EventService.php index d780b8925..a81a56826 100644 --- a/sources/Application/Service/Events/EventService.php +++ b/sources/Application/Service/Events/EventService.php @@ -38,10 +38,6 @@ class EventService */ public static function InitService() { - self::$aEventListeners = []; - self::$iEventIdCounter = 0; - self::$aEventDescription = []; - $aEventServiceSetup = utils::GetClassesForInterface(iEventServiceSetup::class, '', ['[\\\\/]lib[\\\\/]', '[\\\\/]node_modules[\\\\/]', '[\\\\/]test[\\\\/]']); foreach ($aEventServiceSetup as $sEventServiceSetupClass) { /** @var \Combodo\iTop\Service\Events\iEventServiceSetup $oEventServiceSetup */