Apply Update::check() suggestions

This commit is contained in:
Philipp 2023-01-06 12:50:14 +01:00
parent c35fd68ec2
commit baf3225916
No known key found for this signature in database
GPG key ID: 24A7501396EB5432
6 changed files with 5 additions and 9 deletions

View file

@ -84,7 +84,7 @@ $dice = $dice->addRule(LoggerInterface::class,['constructParams' => ['auth_ejabb
\Friendica\Core\Logger\Handler\ErrorHandler::register($dice->create(\Psr\Log\LoggerInterface::class)); \Friendica\Core\Logger\Handler\ErrorHandler::register($dice->create(\Psr\Log\LoggerInterface::class));
// Check the database structure and possibly fixes it // Check the database structure and possibly fixes it
\Friendica\Core\Update::check(\Friendica\DI::basePath(), true, \Friendica\DI::mode()); \Friendica\Core\Update::check(\Friendica\DI::basePath(), true);
$appMode = $dice->create(Mode::class); $appMode = $dice->create(Mode::class);

View file

@ -33,7 +33,6 @@ if (php_sapi_name() !== 'cli') {
use Dice\Dice; use Dice\Dice;
use Friendica\App\Mode; use Friendica\App\Mode;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Update;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
@ -65,9 +64,6 @@ $dice = $dice->addRule(LoggerInterface::class,['constructParams' => ['daemon']])
DI::init($dice); DI::init($dice);
\Friendica\Core\Logger\Handler\ErrorHandler::register($dice->create(\Psr\Log\LoggerInterface::class)); \Friendica\Core\Logger\Handler\ErrorHandler::register($dice->create(\Psr\Log\LoggerInterface::class));
// Check the database structure and possibly fixes it
Update::check(DI::basePath(), true, DI::mode());
if (DI::mode()->isInstall()) { if (DI::mode()->isInstall()) {
die("Friendica isn't properly installed yet.\n"); die("Friendica isn't properly installed yet.\n");
} }

View file

@ -62,7 +62,7 @@ DI::init($dice);
DI::mode()->setExecutor(Mode::WORKER); DI::mode()->setExecutor(Mode::WORKER);
// Check the database structure and possibly fixes it // Check the database structure and possibly fixes it
Update::check(DI::basePath(), true, DI::mode()); Update::check(DI::basePath(), true);
// Quit when in maintenance // Quit when in maintenance
if (!DI::mode()->has(App\Mode::MAINTENANCEDISABLED)) { if (!DI::mode()->has(App\Mode::MAINTENANCEDISABLED)) {

View file

@ -37,7 +37,7 @@ $dice = $dice->addRule(Friendica\App\Mode::class, ['call' => [['determineRunMode
\Friendica\Core\Logger\Handler\ErrorHandler::register($dice->create(\Psr\Log\LoggerInterface::class)); \Friendica\Core\Logger\Handler\ErrorHandler::register($dice->create(\Psr\Log\LoggerInterface::class));
// Check the database structure and possibly fixes it // Check the database structure and possibly fixes it
\Friendica\Core\Update::check(\Friendica\DI::basePath(), true, \Friendica\DI::mode()); \Friendica\Core\Update::check(\Friendica\DI::basePath(), true);
$a = \Friendica\DI::app(); $a = \Friendica\DI::app();

View file

@ -659,7 +659,7 @@ class App
$this->baseURL->redirect('install'); $this->baseURL->redirect('install');
} else { } else {
$this->checkURL(); $this->checkURL();
Core\Update::check($this->getBasePath(), false, $this->mode); Core\Update::check($this->getBasePath(), false);
Core\Addon::loadAddons(); Core\Addon::loadAddons();
Core\Hook::loadHooks(); Core\Hook::loadHooks();
} }

View file

@ -47,7 +47,7 @@ class Update
* @return void * @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function check(string $basePath, bool $via_worker, App\Mode $mode) public static function check(string $basePath, bool $via_worker)
{ {
if (!DBA::connected()) { if (!DBA::connected()) {
return; return;