Merge branch 'develop' into new-addonproxy
This commit is contained in:
commit
d086a982f9
27 changed files with 1268 additions and 108 deletions
40
src/App.php
40
src/App.php
|
|
@ -21,13 +21,10 @@ use Friendica\Core\Addon\AddonHelper;
|
|||
use Friendica\Core\Addon\Capability\ICanLoadAddons;
|
||||
use Friendica\Core\Config\Factory\Config;
|
||||
use Friendica\Core\Container;
|
||||
use Friendica\Core\Hooks\HookEventBridge;
|
||||
use Friendica\Core\Logger\LoggerManager;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session\Capability\IHandleUserSessions;
|
||||
use Friendica\Database\Definition\DbaDefinition;
|
||||
use Friendica\Database\Definition\ViewDefinition;
|
||||
use Friendica\Module\Maintenance;
|
||||
use Friendica\Security\Authentication;
|
||||
use Friendica\Core\Config\Capability\IManageConfigValues;
|
||||
use Friendica\Core\DiceContainer;
|
||||
use Friendica\Core\L10n;
|
||||
|
|
@ -36,9 +33,15 @@ use Friendica\Core\Logger\Handler\ErrorHandler;
|
|||
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Update;
|
||||
use Friendica\Database\Definition\DbaDefinition;
|
||||
use Friendica\Database\Definition\ViewDefinition;
|
||||
use Friendica\Event\ConfigLoadedEvent;
|
||||
use Friendica\Event\Event;
|
||||
use Friendica\Module\Maintenance;
|
||||
use Friendica\Module\Special\HTTPException as ModuleHTTPException;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Protocol\ATProtocol\DID;
|
||||
use Friendica\Security\Authentication;
|
||||
use Friendica\Security\ExAuth;
|
||||
use Friendica\Security\OpenWebAuth;
|
||||
use Friendica\Util\BasePath;
|
||||
|
|
@ -46,6 +49,7 @@ use Friendica\Util\DateTimeFormat;
|
|||
use Friendica\Util\HTTPInputData;
|
||||
use Friendica\Util\HTTPSignature;
|
||||
use Friendica\Util\Profiler;
|
||||
use Psr\EventDispatcher\EventDispatcherInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
|
|
@ -154,6 +158,8 @@ class App
|
|||
|
||||
$this->registerErrorHandler();
|
||||
|
||||
$this->registerEventDispatcher();
|
||||
|
||||
$this->requestId = $this->container->create(Request::class)->getRequestId();
|
||||
$this->auth = $this->container->create(Authentication::class);
|
||||
$this->config = $this->container->create(IManageConfigValues::class);
|
||||
|
|
@ -175,6 +181,7 @@ class App
|
|||
$this->mode,
|
||||
$this->config,
|
||||
$this->profiler,
|
||||
$this->container->create(EventDispatcherInterface::class),
|
||||
$this->appHelper,
|
||||
$addonHelper,
|
||||
);
|
||||
|
|
@ -182,6 +189,7 @@ class App
|
|||
$this->registerTemplateEngine();
|
||||
|
||||
$this->runFrontend(
|
||||
$this->container->create(EventDispatcherInterface::class),
|
||||
$this->container->create(IManagePersonalConfigValues::class),
|
||||
$this->container->create(Page::class),
|
||||
$this->container->create(Nav::class),
|
||||
|
|
@ -207,6 +215,8 @@ class App
|
|||
|
||||
$this->registerErrorHandler();
|
||||
|
||||
$this->registerEventDispatcher();
|
||||
|
||||
$this->load(
|
||||
$serverParams,
|
||||
$this->container->create(DbaDefinition::class),
|
||||
|
|
@ -214,6 +224,7 @@ class App
|
|||
$this->container->create(Mode::class),
|
||||
$this->container->create(IManageConfigValues::class),
|
||||
$this->container->create(Profiler::class),
|
||||
$this->container->create(EventDispatcherInterface::class),
|
||||
$this->container->create(AppHelper::class),
|
||||
$this->container->create(AddonHelper::class),
|
||||
);
|
||||
|
|
@ -236,6 +247,8 @@ class App
|
|||
|
||||
$this->registerErrorHandler();
|
||||
|
||||
$this->registerEventDispatcher();
|
||||
|
||||
$this->load(
|
||||
$serverParams,
|
||||
$this->container->create(DbaDefinition::class),
|
||||
|
|
@ -243,6 +256,7 @@ class App
|
|||
$this->container->create(Mode::class),
|
||||
$this->container->create(IManageConfigValues::class),
|
||||
$this->container->create(Profiler::class),
|
||||
$this->container->create(EventDispatcherInterface::class),
|
||||
$this->container->create(AppHelper::class),
|
||||
$this->container->create(AddonHelper::class),
|
||||
);
|
||||
|
|
@ -308,6 +322,16 @@ class App
|
|||
ErrorHandler::register($this->container->create(LoggerInterface::class));
|
||||
}
|
||||
|
||||
private function registerEventDispatcher(): void
|
||||
{
|
||||
/** @var \Friendica\Event\EventDispatcher */
|
||||
$eventDispatcher = $this->container->create(EventDispatcherInterface::class);
|
||||
|
||||
foreach (HookEventBridge::getStaticSubscribedEvents() as $eventName => $methodName) {
|
||||
$eventDispatcher->addListener($eventName, [HookEventBridge::class, $methodName]);
|
||||
}
|
||||
}
|
||||
|
||||
private function registerTemplateEngine(): void
|
||||
{
|
||||
Renderer::registerTemplateEngine('Friendica\Render\FriendicaSmartyEngine');
|
||||
|
|
@ -323,6 +347,7 @@ class App
|
|||
Mode $mode,
|
||||
IManageConfigValues $config,
|
||||
Profiler $profiler,
|
||||
EventDispatcherInterface $eventDispatcher,
|
||||
AppHelper $appHelper,
|
||||
AddonHelper $addonHelper
|
||||
): void {
|
||||
|
|
@ -347,7 +372,8 @@ class App
|
|||
if ($mode->has(Mode::DBAVAILABLE)) {
|
||||
Core\Hook::loadHooks();
|
||||
$loader = (new Config())->createConfigFileManager($appHelper->getBasePath(), $addonHelper->getAddonPath(), $serverParams);
|
||||
Core\Hook::callAll('load_config', $loader);
|
||||
|
||||
$eventDispatcher->dispatch(new ConfigLoadedEvent(ConfigLoadedEvent::CONFIG_LOADED, $loader));
|
||||
|
||||
// Hooks are now working, reload the whole definitions with hook enabled
|
||||
$dbaDefinition->load(true);
|
||||
|
|
@ -393,6 +419,7 @@ class App
|
|||
* @throws \ImagickException
|
||||
*/
|
||||
private function runFrontend(
|
||||
EventDispatcherInterface $eventDispatcher,
|
||||
IManagePersonalConfigValues $pconfig,
|
||||
Page $page,
|
||||
Nav $nav,
|
||||
|
|
@ -433,7 +460,8 @@ class App
|
|||
$serverVars['REQUEST_METHOD'] === 'GET') {
|
||||
System::externalRedirect($this->baseURL . '/' . $this->args->getQueryString());
|
||||
}
|
||||
Core\Hook::callAll('init_1');
|
||||
|
||||
$eventDispatcher->dispatch(new Event(Event::INIT));
|
||||
}
|
||||
|
||||
DID::routeRequest($this->args->getCommand(), $serverVars);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue