4) Adding Factories to other entrypoints
This commit is contained in:
parent
4af0119b73
commit
1e0e1674f2
20 changed files with 100 additions and 58 deletions
|
@ -33,8 +33,10 @@
|
|||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Factory;
|
||||
use Friendica\Util\BasePath;
|
||||
use Friendica\Util\ExAuth;
|
||||
use Friendica\Util\LoggerFactory;
|
||||
|
||||
if (sizeof($_SERVER["argv"]) == 0) {
|
||||
die();
|
||||
|
@ -52,9 +54,12 @@ chdir($directory);
|
|||
|
||||
require dirname(__DIR__) . '/vendor/autoload.php';
|
||||
|
||||
$logger = LoggerFactory::create('auth_ejabberd');
|
||||
$basedir = BasePath::create(dirname(__DIR__));
|
||||
$configLoader = new Config\ConfigCacheLoader($basedir);
|
||||
$config = Factory\ConfigFactory::createCache($configLoader);
|
||||
$logger = Factory\LoggerFactory::create('auth_ejabberd', $config);
|
||||
|
||||
$a = new App(dirname(__DIR__), $logger);
|
||||
$a = new App($config, $logger);
|
||||
|
||||
if ($a->getMode()->isNormal()) {
|
||||
$oAuth = new ExAuth();
|
||||
|
|
|
@ -3,11 +3,16 @@
|
|||
|
||||
require dirname(__DIR__) . '/vendor/autoload.php';
|
||||
|
||||
use Friendica\Util\LoggerFactory;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Factory;
|
||||
use Friendica\Util\BasePath;
|
||||
|
||||
$logger = LoggerFactory::create('console');
|
||||
$basedir = BasePath::create(dirname(__DIR__));
|
||||
$configLoader = new Config\ConfigCacheLoader($basedir);
|
||||
$config = Factory\ConfigFactory::createCache($configLoader);
|
||||
$logger = Factory\LoggerFactory::create('console', $config);
|
||||
|
||||
$a = new Friendica\App(dirname(__DIR__), $logger);
|
||||
$a = new Friendica\App($config, $logger);
|
||||
\Friendica\BaseObject::setApp($a);
|
||||
|
||||
(new Friendica\Core\Console($argv))->execute();
|
||||
|
|
|
@ -11,7 +11,8 @@ use Friendica\App;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Util\LoggerFactory;
|
||||
use Friendica\Factory;
|
||||
use Friendica\Util\BasePath;
|
||||
|
||||
// Get options
|
||||
$shortopts = 'f';
|
||||
|
@ -32,9 +33,12 @@ if (!file_exists("boot.php") && (sizeof($_SERVER["argv"]) != 0)) {
|
|||
|
||||
require dirname(__DIR__) . '/vendor/autoload.php';
|
||||
|
||||
$logger = LoggerFactory::create('daemon');
|
||||
$basedir = BasePath::create(dirname(__DIR__));
|
||||
$configLoader = new Config\ConfigCacheLoader($basedir);
|
||||
$config = Factory\ConfigFactory::createCache($configLoader);
|
||||
$logger = Factory\LoggerFactory::create('daemon', $config);
|
||||
|
||||
$a = new App(dirname(__DIR__), $logger);
|
||||
$a = new App($config, $logger);
|
||||
|
||||
if ($a->getMode()->isInstall()) {
|
||||
die("Friendica isn't properly installed yet.\n");
|
||||
|
|
|
@ -4,11 +4,13 @@
|
|||
* @file bin/worker.php
|
||||
* @brief Starts the background processing
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Core\Update;
|
||||
use Friendica\Util\LoggerFactory;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Factory;
|
||||
use Friendica\Util\BasePath;
|
||||
|
||||
// Get options
|
||||
$shortopts = 'sn';
|
||||
|
@ -29,12 +31,15 @@ if (!file_exists("boot.php") && (sizeof($_SERVER["argv"]) != 0)) {
|
|||
|
||||
require dirname(__DIR__) . '/vendor/autoload.php';
|
||||
|
||||
$logger = LoggerFactory::create('worker');
|
||||
$basedir = BasePath::create(dirname(__DIR__));
|
||||
$configLoader = new Config\ConfigCacheLoader($basedir);
|
||||
$config = Factory\ConfigFactory::createCache($configLoader);
|
||||
$logger = Factory\LoggerFactory::create('worker', $config);
|
||||
|
||||
$a = new App(dirname(__DIR__), $logger);
|
||||
$a = new App($config, $logger);
|
||||
|
||||
// Check the database structure and possibly fixes it
|
||||
Update::check(true);
|
||||
Update::check($a->getBasePath(), true);
|
||||
|
||||
// Quit when in maintenance
|
||||
if (!$a->getMode()->has(App\Mode::MAINTENANCEDISABLED)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue