use Friendica\Core\Logger;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
+use Friendica\DI;
use Psr\Log\LoggerInterface;
// Get options
$dice = (new Dice())->addRules(include __DIR__ . '/../static/dependencies.config.php');
$dice = $dice->addRule(LoggerInterface::class,['constructParams' => ['daemon']]);
-\Friendica\DI::init($dice);
-$a = \Friendica\DI::app();
+DI::init($dice);
+$a = DI::app();
-if ($a->getMode()->isInstall()) {
+if (DI::mode()->isInstall()) {
die("Friendica isn't properly installed yet.\n");
}
use Friendica\Core\Config;
use Friendica\Core\Update;
use Friendica\Core\Worker;
+use Friendica\DI;
use Psr\Log\LoggerInterface;
// Get options
$dice = (new Dice())->addRules(include __DIR__ . '/../static/dependencies.config.php');
$dice = $dice->addRule(LoggerInterface::class,['constructParams' => ['worker']]);
-\Friendica\DI::init($dice);
-$a = Friendica\DI::app();
+DI::init($dice);
+$a = DI::app();
// Check the database structure and possibly fixes it
-Update::check($a->getBasePath(), true, $a->getMode());
+Update::check($a->getBasePath(), true, DI::mode());
// Quit when in maintenance
-if (!$a->getMode()->has(App\Mode::MAINTENANCEDISABLED)) {
+if (!DI::mode()->has(App\Mode::MAINTENANCEDISABLED)) {
return;
}
return $this->config->getCache()->get('system', 'basepath');
}
- /**
- * Returns the Mode of the Application
- *
- * @return App\Mode The Application Mode
- */
- public function getMode()
- {
- return $this->mode;
- }
-
/**
* Returns the Database of the Application
*
$args = ['no_cron' => !$do_cron];
$a = get_app();
- $process = new Core\Process(DI::logger(), $a->getMode(), DI::config(), $a->getBasePath());
+ $process = new Core\Process(DI::logger(), DI::mode(), DI::config(), $a->getBasePath());
$process->run($command, $args);
// after spawning we have to remove the flag.
$priority = PRIORITY_MEDIUM;
// Don't fork from frontend tasks by default
- $dont_fork = Config::get("system", "worker_dont_fork", false) || !\get_app()->getMode()->isBackend();
+ $dont_fork = Config::get("system", "worker_dont_fork", false) || !DI::mode()->isBackend();
$created = DateTimeFormat::utcNow();
$force_priority = false;
}
// check legacy basepath settings
- $configLoader = new ConfigFileLoader($a->getBasePath(), $a->getMode());
+ $configLoader = new ConfigFileLoader($a->getBasePath());
$configCache = new Config\Cache\ConfigCache();
$configLoader->setupCache($configCache);
$confBasepath = $configCache->get('system', 'basepath');
{
$a = DI::app();
- if (!$a->getMode()->isInstall()) {
+ if (!DI::mode()->isInstall()) {
throw new HTTPException\ForbiddenException();
}