use Friendica\Module\Maintenance;
use Friendica\Security\Authentication;
use Friendica\Core\Config\Capability\IManageConfigValues;
+use Friendica\Core\DiceContainer;
use Friendica\Core\L10n;
use Friendica\Core\Logger\Capability\LogChannel;
use Friendica\Core\Logger\Handler\ErrorHandler;
$this->setupContainerForLogger(LogChannel::APP);
- $this->container->setup();
+ $this->setupLegacyServiceLocator();
$this->registerErrorHandler();
$this->setupContainerForLogger($this->determineLogChannel($argv));
- $this->container->setup();
+ $this->setupLegacyServiceLocator();
$this->registerErrorHandler();
$this->setupContainerForLogger(LogChannel::AUTH_JABBERED);
- $this->container->setup();
+ $this->setupLegacyServiceLocator();
$this->registerErrorHandler();
]);
}
+ private function setupLegacyServiceLocator(): void
+ {
+ if ($this->container instanceof DiceContainer) {
+ DI::init($this->container->getDice());
+ }
+ }
+
private function registerErrorHandler(): void
{
ErrorHandler::register($this->container->create(LoggerInterface::class));
namespace Friendica\Core;
use Dice\Dice;
-use Friendica\DI;
/**
* Wrapper for the Dice class to make some basic setups
*/
public function setup(): void
{
- $this->setupLegacyServiceLocator();
+ // this method can be removed
}
/**
$this->container = $this->container->addRule($name, $rule);
}
- private function setupLegacyServiceLocator(): void
+ /**
+ * Only used to inject Dice into DI class
+ *
+ * @see \Friendica\DI
+ *
+ * @internal
+ *
+ * @deprecated
+ */
+ public function getDice(): Dice
{
- DI::init($this->container);
+ return $this->container;
}
}