Remove DependencyFactory
- Include all necessary classes in `dependencies.config.php` - Add DI-reference to BaseObject (acts as a global registry) - Refactor all static "init()" methods to use the global registry - Refactor Logging for Worker-Logger a little bit
This commit is contained in:
parent
8b344141da
commit
6c2cf494b5
21 changed files with 188 additions and 280 deletions
|
@ -32,7 +32,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\Factory;
|
||||
use Friendica\Util\ExAuth;
|
||||
|
||||
if (sizeof($_SERVER["argv"]) == 0) {
|
||||
|
@ -54,9 +53,9 @@ require dirname(__DIR__) . '/vendor/autoload.php';
|
|||
$dice = new \Dice\Dice();
|
||||
$dice = $dice->addRules(include __DIR__ . '/../static/dependencies.config.php');
|
||||
|
||||
$a = Factory\DependencyFactory::setUp('auth_ejabbered', $dice);
|
||||
$appMode = $dice->create(\Friendica\App\Mode::class);
|
||||
|
||||
if ($a->getMode()->isNormal()) {
|
||||
if ($appMode->isNormal()) {
|
||||
$oAuth = new ExAuth();
|
||||
$oAuth->readStdin();
|
||||
}
|
||||
|
|
|
@ -3,12 +3,9 @@
|
|||
|
||||
require dirname(__DIR__) . '/vendor/autoload.php';
|
||||
|
||||
use Friendica\Factory;
|
||||
|
||||
$dice = new \Dice\Dice();
|
||||
$dice = $dice->addRules(include __DIR__ . '/../static/dependencies.config.php');
|
||||
|
||||
$a = Factory\DependencyFactory::setUp('console', $dice);
|
||||
\Friendica\BaseObject::setApp($a);
|
||||
\Friendica\BaseObject::setDependencyInjection($dice);
|
||||
|
||||
(new Friendica\Core\Console($argv))->execute();
|
||||
|
|
|
@ -11,7 +11,6 @@ use Friendica\Core\Config;
|
|||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Factory;
|
||||
|
||||
// Get options
|
||||
$shortopts = 'f';
|
||||
|
@ -35,7 +34,8 @@ require dirname(__DIR__) . '/vendor/autoload.php';
|
|||
$dice = new \Dice\Dice();
|
||||
$dice = $dice->addRules(include __DIR__ . '/../static/dependencies.config.php');
|
||||
|
||||
$a = Factory\DependencyFactory::setUp('daemon', $dice);
|
||||
\Friendica\BaseObject::setDependencyInjection($dice);
|
||||
$a = \Friendica\BaseObject::getApp();
|
||||
|
||||
if ($a->getMode()->isInstall()) {
|
||||
die("Friendica isn't properly installed yet.\n");
|
||||
|
@ -147,7 +147,7 @@ if (!$foreground) {
|
|||
file_put_contents($pidfile, $pid);
|
||||
|
||||
// We lose the database connection upon forking
|
||||
$a->getDatabase()->reconnect();
|
||||
DBA::reconnect();
|
||||
}
|
||||
|
||||
Config::set('system', 'worker_daemon_mode', true);
|
||||
|
|
|
@ -9,7 +9,6 @@ use Friendica\App;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Update;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Factory;
|
||||
|
||||
// Get options
|
||||
$shortopts = 'sn';
|
||||
|
@ -33,7 +32,8 @@ require dirname(__DIR__) . '/vendor/autoload.php';
|
|||
$dice = new \Dice\Dice();
|
||||
$dice = $dice->addRules(include __DIR__ . '/../static/dependencies.config.php');
|
||||
|
||||
$a = Factory\DependencyFactory::setUp('worker', $dice);
|
||||
\Friendica\BaseObject::setDependencyInjection($dice);
|
||||
$a = \Friendica\BaseObject::getApp();
|
||||
|
||||
// Check the database structure and possibly fixes it
|
||||
Update::check($a->getBasePath(), true, $a->getMode());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue