[CORE][GNUSocial] Prevent multiple initializations

This commit is contained in:
Hugo Sales 2022-11-20 21:54:36 +00:00
parent 360a95c7aa
commit 9cf83db62a
No known key found for this signature in database
GPG Key ID: 7D0C7EAFC9D835A0

View File

@ -153,27 +153,31 @@ class GNUsocial implements EventSubscriberInterface
*/
public function initialize(): void
{
Common::setupConfig($this->config);
if (!\is_null($this->request)) {
Common::setRequest($this->request);
if (!$this->initialized) {
Common::setupConfig($this->config);
if (!\is_null($this->request)) {
Common::setRequest($this->request);
}
Log::setLogger($this->logger);
Event::setDispatcher($this->event_dispatcher);
I18n::setTranslator($this->translator);
DB::setManager($this->entity_manager);
Form::setFactory($this->form_factory);
Queue::setMessageBus($this->message_bus);
Security::setHelper($this->security);
HTML::setSanitizer($this->sanitizer);
Router::setRouter($this->router);
HTTPClient::setClient($this->client);
Formatting::setTwig($this->twig);
Cache::setupCache();
DB::initTableMap();
// Events are preloaded on compilation, but set at runtime, along with configuration
$this->module_manager->loadModules();
$this->initialized = true;
}
Log::setLogger($this->logger);
Event::setDispatcher($this->event_dispatcher);
I18n::setTranslator($this->translator);
DB::setManager($this->entity_manager);
Form::setFactory($this->form_factory);
Queue::setMessageBus($this->message_bus);
Security::setHelper($this->security);
HTML::setSanitizer($this->sanitizer);
Router::setRouter($this->router);
HTTPClient::setClient($this->client);
Formatting::setTwig($this->twig);
Cache::setupCache();
DB::initTableMap();
// Events are preloaded on compilation, but set at runtime, along with configuration
$this->module_manager->loadModules();
}
/**