Introduce DICE

- Adding dice library
- Adding dependency config

- Removing Factories
- Refactoring App\Mode constructor
- Refactoring App\Router constructor
- Refactoring BasePath for DI usage
- Refactoring ConfigFileLoader constructor
- Refactoring Profiler constructor

- Adjust entrypoints (index, console, worker, ..)

- Adding functional test for DI
- Fix tests because of refactorings
This commit is contained in:
Philipp Holzer 2019-07-21 01:22:10 +02:00
commit 55999730e0
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
28 changed files with 563 additions and 308 deletions

View file

@ -51,7 +51,10 @@ chdir($directory);
require dirname(__DIR__) . '/vendor/autoload.php';
$a = Factory\DependencyFactory::setUp('auth_ejabbered', dirname(__DIR__));
$dice = new \Dice\Dice();
$dice = $dice->addRules(include __DIR__ . '/../static/dependencies.config.php');
$a = Factory\DependencyFactory::setUp('auth_ejabbered', $dice);
if ($a->getMode()->isNormal()) {
$oAuth = new ExAuth();

View file

@ -5,7 +5,10 @@ require dirname(__DIR__) . '/vendor/autoload.php';
use Friendica\Factory;
$a = Factory\DependencyFactory::setUp('console', dirname(__DIR__));
$dice = new \Dice\Dice();
$dice = $dice->addRules(include __DIR__ . '/../static/dependencies.config.php');
$a = Factory\DependencyFactory::setUp('console', $dice);
\Friendica\BaseObject::setApp($a);
(new Friendica\Core\Console($argv))->execute();

View file

@ -32,7 +32,10 @@ if (!file_exists("boot.php") && (sizeof($_SERVER["argv"]) != 0)) {
require dirname(__DIR__) . '/vendor/autoload.php';
$a = Factory\DependencyFactory::setUp('daemon', dirname(__DIR__));
$dice = new \Dice\Dice();
$dice = $dice->addRules(include __DIR__ . '/../static/dependencies.config.php');
$a = Factory\DependencyFactory::setUp('daemon', $dice);
if ($a->getMode()->isInstall()) {
die("Friendica isn't properly installed yet.\n");

View file

@ -30,7 +30,10 @@ if (!file_exists("boot.php") && (sizeof($_SERVER["argv"]) != 0)) {
require dirname(__DIR__) . '/vendor/autoload.php';
$a = Factory\DependencyFactory::setUp('worker', dirname(__DIR__));
$dice = new \Dice\Dice();
$dice = $dice->addRules(include __DIR__ . '/../static/dependencies.config.php');
$a = Factory\DependencyFactory::setUp('worker', $dice);
// Check the database structure and possibly fixes it
Update::check($a->getBasePath(), true, $a->getMode());