[FRAMEWORK] Avoid double initializing the framework
This commit is contained in:
parent
aac653d2bd
commit
152828ed68
@ -67,6 +67,7 @@ class GNUsocial implements EventSubscriberInterface
|
|||||||
{
|
{
|
||||||
use TargetPathTrait;
|
use TargetPathTrait;
|
||||||
|
|
||||||
|
protected bool $initialized = false;
|
||||||
protected LoggerInterface $logger;
|
protected LoggerInterface $logger;
|
||||||
protected TranslatorInterface $translator;
|
protected TranslatorInterface $translator;
|
||||||
protected EntityManagerInterface $entity_manager;
|
protected EntityManagerInterface $entity_manager;
|
||||||
@ -92,7 +93,7 @@ class GNUsocial implements EventSubscriberInterface
|
|||||||
SessionInterface $sess,
|
SessionInterface $sess,
|
||||||
SSecurity $sec,
|
SSecurity $sec,
|
||||||
MailerInterface $mail,
|
MailerInterface $mail,
|
||||||
ModuleManager $mod)
|
ModuleManager $mm)
|
||||||
{
|
{
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
$this->translator = $trans;
|
$this->translator = $trans;
|
||||||
@ -104,7 +105,7 @@ class GNUsocial implements EventSubscriberInterface
|
|||||||
$this->session = $sess;
|
$this->session = $sess;
|
||||||
$this->security = $sec;
|
$this->security = $sec;
|
||||||
$this->mailer = $mail;
|
$this->mailer = $mail;
|
||||||
$this->module_manager = $mod;
|
$this->module_manager = $mm;
|
||||||
|
|
||||||
$this->initialize();
|
$this->initialize();
|
||||||
}
|
}
|
||||||
@ -116,11 +117,11 @@ class GNUsocial implements EventSubscriberInterface
|
|||||||
*/
|
*/
|
||||||
public function initialize(): void
|
public function initialize(): void
|
||||||
{
|
{
|
||||||
|
if (!$this->initialized) {
|
||||||
Log::setLogger($this->logger);
|
Log::setLogger($this->logger);
|
||||||
Event::setDispatcher($this->event_dispatcher);
|
Event::setDispatcher($this->event_dispatcher);
|
||||||
I18n::setTranslator($this->translator);
|
I18n::setTranslator($this->translator);
|
||||||
DB::setManager($this->entity_manager);
|
DB::setManager($this->entity_manager);
|
||||||
Router::setRouter($this->router);
|
|
||||||
Form::setFactory($this->form_factory);
|
Form::setFactory($this->form_factory);
|
||||||
Queue::setMessageBus($this->message_bus);
|
Queue::setMessageBus($this->message_bus);
|
||||||
Security::setHelper($this->security);
|
Security::setHelper($this->security);
|
||||||
@ -130,7 +131,13 @@ class GNUsocial implements EventSubscriberInterface
|
|||||||
|
|
||||||
Cache::setupCache();
|
Cache::setupCache();
|
||||||
|
|
||||||
|
// Events are proloaded on compilation, but set at runtime
|
||||||
$this->module_manager->loadModules();
|
$this->module_manager->loadModules();
|
||||||
|
|
||||||
|
Router::setRouter($this->router);
|
||||||
|
|
||||||
|
$this->initialized = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user