Move registerTemplateEngine() into App class

This commit is contained in:
Art4 2025-01-09 08:36:47 +00:00
parent 768d7961a6
commit 04fb9dd9e0
3 changed files with 6 additions and 14 deletions

View file

@ -175,6 +175,8 @@ class App
{ {
$this->setupContainerForAddons(); $this->setupContainerForAddons();
$this->registerTemplateEngine();
(\Friendica\Core\Console::create($this->container, $argv))->execute(); (\Friendica\Core\Console::create($this->container, $argv))->execute();
} }
@ -184,6 +186,8 @@ class App
$this->container->setup(LogChannel::AUTH_JABBERED, false); $this->container->setup(LogChannel::AUTH_JABBERED, false);
$this->registerTemplateEngine();
/** @var BasePath */ /** @var BasePath */
$basePath = $this->container->create(BasePath::class); $basePath = $this->container->create(BasePath::class);

View file

@ -22,11 +22,10 @@ interface Container
* @deprecated * @deprecated
* *
* @param string $logChannel The Log Channel of this call * @param string $logChannel The Log Channel of this call
* @param bool $withTemplateEngine true, if the template engine should be set too
* *
* @return void * @return void
*/ */
public function setup(string $logChannel = LogChannel::DEFAULT, bool $withTemplateEngine = true): void; public function setup(string $logChannel = LogChannel::DEFAULT): void;
/** /**
* Returns a fully constructed object based on $name using $args and $share as constructor arguments if supplied * Returns a fully constructed object based on $name using $args and $share as constructor arguments if supplied

View file

@ -10,7 +10,6 @@ declare(strict_types=1);
namespace Friendica\Core; namespace Friendica\Core;
use Dice\Dice; use Dice\Dice;
use Friendica\Core\Addon\Capability\ICanLoadAddons;
use Friendica\Core\Logger\Capability\LogChannel; use Friendica\Core\Logger\Capability\LogChannel;
use Friendica\Core\Logger\Handler\ErrorHandler; use Friendica\Core\Logger\Handler\ErrorHandler;
use Friendica\DI; use Friendica\DI;
@ -43,19 +42,14 @@ final class DiceContainer implements Container
* @deprecated * @deprecated
* *
* @param string $logChannel The Log Channel of this call * @param string $logChannel The Log Channel of this call
* @param bool $withTemplateEngine true, if the template engine should be set too
* *
* @return void * @return void
*/ */
public function setup(string $logChannel = LogChannel::DEFAULT, bool $withTemplateEngine = true): void public function setup(string $logChannel = LogChannel::DEFAULT): void
{ {
$this->setupContainerForLogger($logChannel); $this->setupContainerForLogger($logChannel);
$this->setupLegacyServiceLocator(); $this->setupLegacyServiceLocator();
$this->registerErrorHandler(); $this->registerErrorHandler();
if ($withTemplateEngine) {
$this->registerTemplateEngine();
}
} }
/** /**
@ -100,9 +94,4 @@ final class DiceContainer implements Container
{ {
ErrorHandler::register($this->container->create(LoggerInterface::class)); ErrorHandler::register($this->container->create(LoggerInterface::class));
} }
private function registerTemplateEngine(): void
{
Renderer::registerTemplateEngine('Friendica\Render\FriendicaSmartyEngine');
}
} }