Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: Use DI for Setup class and move away from deprecated methods
Signed-off-by: Côme Chilliet <[email protected]>
  • Loading branch information
come-nc committed Jan 29, 2024
commit ccc66e912b171ba7bb4e5b4478508a22202eb356
18 changes: 5 additions & 13 deletions core/Command/Maintenance/Install.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
Expand Down Expand Up @@ -33,12 +36,9 @@
use bantu\IniGetWrapper\IniGetWrapper;
use InvalidArgumentException;
use OC\Console\TimestampFormatter;
use OC\Installer;
use OC\Migration\ConsoleOutput;
use OC\Setup;
use OC\SystemConfig;
use OCP\Defaults;
use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface;
Expand All @@ -56,7 +56,7 @@ public function __construct(
parent::__construct();
}

protected function configure() {
protected function configure(): void {
$this
->setName('maintenance:install')
->setDescription('install Nextcloud')
Expand All @@ -76,15 +76,7 @@ protected function configure() {
protected function execute(InputInterface $input, OutputInterface $output): int {
// validate the environment
$server = \OC::$server;
$setupHelper = new Setup(
$this->config,
$this->iniGetWrapper,
$server->getL10N('lib'),
$server->query(Defaults::class),
$server->get(LoggerInterface::class),
$server->getSecureRandom(),
\OC::$server->query(Installer::class)
);
$setupHelper = \OCP\Server::get(\OC\Setup::class);
$sysInfo = $setupHelper->getSystemInfo(true);
$errors = $sysInfo['errors'];
if (count($errors) > 0) {
Expand Down
12 changes: 1 addition & 11 deletions lib/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -988,17 +988,7 @@ public static function handleRequest(): void {
// Check if Nextcloud is installed or in maintenance (update) mode
if (!$systemConfig->getValue('installed', false)) {
\OC::$server->getSession()->clear();
$logger = Server::get(\Psr\Log\LoggerInterface::class);
$setupHelper = new OC\Setup(
$systemConfig,
Server::get(\bantu\IniGetWrapper\IniGetWrapper::class),
Server::get(\OCP\L10N\IFactory::class)->get('lib'),
Server::get(\OCP\Defaults::class),
$logger,
Server::get(\OCP\Security\ISecureRandom::class),
Server::get(\OC\Installer::class)
);
$controller = new OC\Core\Controller\SetupController($setupHelper, $logger);
$controller = Server::get(\OC\Core\Controller\SetupController::class);
$controller->run($_POST);
exit();
}
Expand Down
3 changes: 3 additions & 0 deletions lib/private/Installer.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
* @copyright Copyright (c) 2016, Lukas Reschke <[email protected]>
Expand Down
Loading