diff options
author | Côme Chilliet <91878298+come-nc@users.noreply.github.com> | 2024-01-30 11:10:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-30 11:10:52 +0100 |
commit | 6533431c36792b628b7d2088d2e02a2bcca26230 (patch) | |
tree | b562df3c764012d41f07ad71833a880310a73921 /lib | |
parent | 063c051cdcfbaf1f623337f6f1239438b35d094c (diff) | |
parent | 67e3ecef98cceb947e8d3d5df7695f5f68ad0b6c (diff) | |
download | nextcloud-server-6533431c36792b628b7d2088d2e02a2bcca26230.tar.gz nextcloud-server-6533431c36792b628b7d2088d2e02a2bcca26230.zip |
Merge pull request #43191 from nextcloud/fix/use-di-for-setup-class
Diffstat (limited to 'lib')
-rw-r--r-- | lib/base.php | 12 | ||||
-rw-r--r-- | lib/private/Installer.php | 101 | ||||
-rw-r--r-- | lib/private/Setup.php | 235 | ||||
-rw-r--r-- | lib/private/legacy/OC_App.php | 4 | ||||
-rw-r--r-- | lib/private/legacy/OC_Util.php | 10 |
5 files changed, 139 insertions, 223 deletions
diff --git a/lib/base.php b/lib/base.php index d0a2072cc66..e4fdb8efb44 100644 --- a/lib/base.php +++ b/lib/base.php @@ -988,17 +988,7 @@ class OC { // 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(); } diff --git a/lib/private/Installer.php b/lib/private/Installer.php index dd4f1f790e3..6ab497b9dea 100644 --- a/lib/private/Installer.php +++ b/lib/private/Installer.php @@ -1,4 +1,7 @@ <?php + +declare(strict_types=1); + /** * @copyright Copyright (c) 2016, ownCloud, Inc. * @copyright Copyright (c) 2016, Lukas Reschke <lukas@statuscode.ch> @@ -61,37 +64,17 @@ use Psr\Log\LoggerInterface; * This class provides the functionality needed to install, update and remove apps */ class Installer { - /** @var AppFetcher */ - private $appFetcher; - /** @var IClientService */ - private $clientService; - /** @var ITempManager */ - private $tempManager; - /** @var LoggerInterface */ - private $logger; - /** @var IConfig */ - private $config; - /** @var array - for caching the result of app fetcher */ - private $apps = null; - /** @var bool|null - for caching the result of the ready status */ - private $isInstanceReadyForUpdates = null; - /** @var bool */ - private $isCLI; + private ?bool $isInstanceReadyForUpdates = null; + private ?array $apps = null; public function __construct( - AppFetcher $appFetcher, - IClientService $clientService, - ITempManager $tempManager, - LoggerInterface $logger, - IConfig $config, - bool $isCLI + private AppFetcher $appFetcher, + private IClientService $clientService, + private ITempManager $tempManager, + private LoggerInterface $logger, + private IConfig $config, + private bool $isCLI, ) { - $this->appFetcher = $appFetcher; - $this->clientService = $clientService; - $this->tempManager = $tempManager; - $this->logger = $logger; - $this->config = $config; - $this->isCLI = $isCLI; } /** @@ -114,7 +97,7 @@ class Installer { throw new \Exception('The appinfo/database.xml file is not longer supported. Used in ' . $appId); } - $l = \OC::$server->getL10N('core'); + $l = \OCP\Util::getL10N('core'); $info = \OCP\Server::get(IAppManager::class)->getAppInfo($basedir . '/appinfo/info.xml', true, $l->getLanguageCode()); if (!is_array($info)) { @@ -151,7 +134,7 @@ class Installer { } //install the database - $ms = new MigrationService($info['id'], \OC::$server->get(Connection::class)); + $ms = new MigrationService($info['id'], \OCP\Server::get(Connection::class)); $ms->migrate('latest', !$previousVersion); if ($previousVersion) { @@ -165,16 +148,17 @@ class Installer { OC_App::executeRepairSteps($appId, $info['repair-steps']['install']); + $config = \OCP\Server::get(IConfig::class); //set the installed version - \OC::$server->getConfig()->setAppValue($info['id'], 'installed_version', \OCP\Server::get(IAppManager::class)->getAppVersion($info['id'], false)); - \OC::$server->getConfig()->setAppValue($info['id'], 'enabled', 'no'); + $config->setAppValue($info['id'], 'installed_version', \OCP\Server::get(IAppManager::class)->getAppVersion($info['id'], false)); + $config->setAppValue($info['id'], 'enabled', 'no'); //set remote/public handlers foreach ($info['remote'] as $name => $path) { - \OC::$server->getConfig()->setAppValue('core', 'remote_'.$name, $info['id'].'/'.$path); + $config->setAppValue('core', 'remote_'.$name, $info['id'].'/'.$path); } foreach ($info['public'] as $name => $path) { - \OC::$server->getConfig()->setAppValue('core', 'public_'.$name, $info['id'].'/'.$path); + $config->setAppValue('core', 'public_'.$name, $info['id'].'/'.$path); } OC_App::setAppTypes($info['id']); @@ -185,11 +169,9 @@ class Installer { /** * Updates the specified app from the appstore * - * @param string $appId - * @param bool [$allowUnstable] Allow unstable releases - * @return bool + * @param bool $allowUnstable Allow unstable releases */ - public function updateAppstoreApp($appId, $allowUnstable = false) { + public function updateAppstoreApp(string $appId, bool $allowUnstable = false): bool { if ($this->isUpdateAvailable($appId, $allowUnstable)) { try { $this->downloadApp($appId, $allowUnstable); @@ -225,7 +207,7 @@ class Installer { * * @throws \Exception If the installation was not successful */ - public function downloadApp($appId, $allowUnstable = false) { + public function downloadApp(string $appId, bool $allowUnstable = false): void { $appId = strtolower($appId); $apps = $this->appFetcher->get($allowUnstable); @@ -401,10 +383,10 @@ class Installer { * @param bool $allowUnstable * @return string|false false or the version number of the update */ - public function isUpdateAvailable($appId, $allowUnstable = false) { + public function isUpdateAvailable($appId, $allowUnstable = false): string|false { if ($this->isInstanceReadyForUpdates === null) { $installPath = OC_App::getInstallPath(); - if ($installPath === false || $installPath === null) { + if ($installPath === null) { $this->isInstanceReadyForUpdates = false; } else { $this->isInstanceReadyForUpdates = true; @@ -444,12 +426,10 @@ class Installer { /** * Check if app has been installed from git - * @param string $name name of the application to remove - * @return boolean * * The function will check if the path contains a .git folder */ - private function isInstalledFromGit($appId) { + private function isInstalledFromGit(string $appId): bool { $app = \OC_App::findAppInDirectories($appId); if ($app === false) { return false; @@ -460,12 +440,10 @@ class Installer { /** * Check if app is already downloaded - * @param string $name name of the application to remove - * @return boolean * * The function will check if the app is already downloaded in the apps repository */ - public function isDownloaded($name) { + public function isDownloaded(string $name): bool { foreach (\OC::$APPSROOTS as $dir) { $dirToTest = $dir['path']; $dirToTest .= '/'; @@ -482,9 +460,6 @@ class Installer { /** * Removes an app - * @param string $appId ID of the application to remove - * @return boolean - * * * This function works as follows * -# call uninstall repair steps @@ -493,9 +468,9 @@ class Installer { * The function will not delete preferences, tables and the configuration, * this has to be done by the function oc_app_uninstall(). */ - public function removeApp($appId) { + public function removeApp(string $appId): bool { if ($this->isDownloaded($appId)) { - if (\OC::$server->getAppManager()->isShipped($appId)) { + if (\OCP\Server::get(IAppManager::class)->isShipped($appId)) { return false; } $appDir = OC_App::getInstallPath() . '/' . $appId; @@ -511,10 +486,9 @@ class Installer { /** * Installs the app within the bundle and marks the bundle as installed * - * @param Bundle $bundle * @throws \Exception If app could not get installed */ - public function installAppBundle(Bundle $bundle) { + public function installAppBundle(Bundle $bundle): void { $appIds = $bundle->getAppIdentifiers(); foreach ($appIds as $appId) { if (!$this->isDownloaded($appId)) { @@ -537,12 +511,12 @@ class Installer { * working ownCloud at the end instead of an aborted update. * @return array Array of error messages (appid => Exception) */ - public static function installShippedApps($softErrors = false, ?IOutput $output = null) { + public static function installShippedApps(bool $softErrors = false, ?IOutput $output = null): array { if ($output instanceof IOutput) { $output->debug('Installing shipped apps'); } - $appManager = \OC::$server->getAppManager(); - $config = \OC::$server->getConfig(); + $appManager = \OCP\Server::get(IAppManager::class); + $config = \OCP\Server::get(IConfig::class); $errors = []; foreach (\OC::$APPSROOTS as $app_dir) { if ($dir = opendir($app_dir['path'])) { @@ -581,10 +555,8 @@ class Installer { /** * install an app already placed in the app folder - * @param string $app id of the app to install - * @return string */ - public static function installShippedApp($app, ?IOutput $output = null) { + public static function installShippedApp(string $app, ?IOutput $output = null): string|false { if ($output instanceof IOutput) { $output->debug('Installing ' . $app); } @@ -592,9 +564,9 @@ class Installer { $appPath = OC_App::getAppPath($app); \OC_App::registerAutoloading($app, $appPath); - $config = \OC::$server->getConfig(); + $config = \OCP\Server::get(IConfig::class); - $ms = new MigrationService($app, \OC::$server->get(Connection::class)); + $ms = new MigrationService($app, \OCP\Server::get(Connection::class)); if ($output instanceof IOutput) { $ms->setOutput($output); } @@ -633,10 +605,7 @@ class Installer { return $info['id']; } - /** - * @param string $script - */ - private static function includeAppScript($script) { + private static function includeAppScript(string $script): void { if (file_exists($script)) { include $script; } diff --git a/lib/private/Setup.php b/lib/private/Setup.php index 3cd3716c195..650dca97067 100644 --- a/lib/private/Setup.php +++ b/lib/private/Setup.php @@ -1,4 +1,7 @@ <?php + +declare(strict_types=1); + /** * @copyright Copyright (c) 2016, ownCloud, Inc. * @@ -57,48 +60,37 @@ use OC\Log\Rotate; use OC\Preview\BackgroundCleanupJob; use OC\TextProcessing\RemoveOldTasksBackgroundJob; use OCP\AppFramework\Utility\ITimeFactory; +use OCP\BackgroundJob\IJobList; use OCP\Defaults; +use OCP\IConfig; use OCP\IGroup; +use OCP\IGroupManager; use OCP\IL10N; +use OCP\IRequest; +use OCP\IUserManager; +use OCP\IUserSession; +use OCP\L10N\IFactory as IL10NFactory; use OCP\Migration\IOutput; use OCP\Security\ISecureRandom; +use OCP\Server; use Psr\Log\LoggerInterface; class Setup { - /** @var SystemConfig */ - protected $config; - /** @var IniGetWrapper */ - protected $iniWrapper; - /** @var IL10N */ - protected $l10n; - /** @var Defaults */ - protected $defaults; - /** @var LoggerInterface */ - protected $logger; - /** @var ISecureRandom */ - protected $random; - /** @var Installer */ - protected $installer; + protected IL10N $l10n; public function __construct( - SystemConfig $config, - IniGetWrapper $iniWrapper, - IL10N $l10n, - Defaults $defaults, - LoggerInterface $logger, - ISecureRandom $random, - Installer $installer + protected SystemConfig $config, + protected IniGetWrapper $iniWrapper, + IL10NFactory $l10nFactory, + protected Defaults $defaults, + protected LoggerInterface $logger, + protected ISecureRandom $random, + protected Installer $installer ) { - $this->config = $config; - $this->iniWrapper = $iniWrapper; - $this->l10n = $l10n; - $this->defaults = $defaults; - $this->logger = $logger; - $this->random = $random; - $this->installer = $installer; + $this->l10n = $l10nFactory->get('lib'); } - protected static $dbSetupClasses = [ + protected static array $dbSetupClasses = [ 'mysql' => \OC\Setup\MySQL::class, 'pgsql' => \OC\Setup\PostgreSQL::class, 'oci' => \OC\Setup\OCI::class, @@ -108,30 +100,22 @@ class Setup { /** * Wrapper around the "class_exists" PHP function to be able to mock it - * - * @param string $name - * @return bool */ - protected function class_exists($name) { + protected function class_exists(string $name): bool { return class_exists($name); } /** * Wrapper around the "is_callable" PHP function to be able to mock it - * - * @param string $name - * @return bool */ - protected function is_callable($name) { + protected function is_callable(string $name): bool { return is_callable($name); } /** * Wrapper around \PDO::getAvailableDrivers - * - * @return array */ - protected function getAvailableDbDriversForPdo() { + protected function getAvailableDbDriversForPdo(): array { if (class_exists(\PDO::class)) { return \PDO::getAvailableDrivers(); } @@ -141,11 +125,10 @@ class Setup { /** * Get the available and supported databases of this instance * - * @param bool $allowAllDatabases * @return array * @throws Exception */ - public function getSupportedDatabases($allowAllDatabases = false) { + public function getSupportedDatabases(bool $allowAllDatabases = false): array { $availableDatabases = [ 'sqlite' => [ 'type' => 'pdo', @@ -207,7 +190,7 @@ class Setup { * @return array of system info, including an "errors" value * in case of errors/warnings */ - public function getSystemInfo($allowAllDatabases = false) { + public function getSystemInfo(bool $allowAllDatabases = false): array { $databases = $this->getSupportedDatabases($allowAllDatabases); $dataDir = $this->config->getValue('datadirectory', \OC::$SERVERROOT . '/data'); @@ -227,7 +210,7 @@ class Setup { try { $util = new \OC_Util(); - $htAccessWorking = $util->isHtaccessWorking(\OC::$server->getConfig()); + $htAccessWorking = $util->isHtaccessWorking(Server::get(IConfig::class)); } catch (\OCP\HintException $e) { $errors[] = [ 'error' => $e->getMessage(), @@ -273,10 +256,9 @@ class Setup { } /** - * @param $options - * @return array + * @return array<string|array> errors */ - public function install($options, ?IOutput $output = null) { + public function install(array $options, ?IOutput $output = null): array { $l = $this->l10n; $error = []; @@ -314,7 +296,7 @@ class Setup { return $error; } - $request = \OC::$server->getRequest(); + $request = Server::get(IRequest::class); //no errors, good if (isset($options['trusted_domains']) @@ -387,78 +369,83 @@ class Setup { //create the user and group $user = null; try { - $user = \OC::$server->getUserManager()->createUser($username, $password); + $user = Server::get(IUserManager::class)->createUser($username, $password); if (!$user) { $error[] = "User <$username> could not be created."; + return $error; } } catch (Exception $exception) { $error[] = $exception->getMessage(); + return $error; } - if (empty($error)) { - $config = \OC::$server->getConfig(); - $config->setAppValue('core', 'installedat', (string)microtime(true)); - $config->setAppValue('core', 'lastupdatedat', (string)microtime(true)); + $config = Server::get(IConfig::class); + $config->setAppValue('core', 'installedat', (string)microtime(true)); + $config->setAppValue('core', 'lastupdatedat', (string)microtime(true)); - $vendorData = $this->getVendorData(); - $config->setAppValue('core', 'vendor', $vendorData['vendor']); - if ($vendorData['channel'] !== 'stable') { - $config->setSystemValue('updater.release.channel', $vendorData['channel']); - } + $vendorData = $this->getVendorData(); + $config->setAppValue('core', 'vendor', $vendorData['vendor']); + if ($vendorData['channel'] !== 'stable') { + $config->setSystemValue('updater.release.channel', $vendorData['channel']); + } - $group = \OC::$server->getGroupManager()->createGroup('admin'); - if ($group instanceof IGroup) { - $group->addUser($user); - } + $group = Server::get(IGroupManager::class)->createGroup('admin'); + if ($group instanceof IGroup) { + $group->addUser($user); + } - // Install shipped apps and specified app bundles - $this->outputDebug($output, 'Install default apps'); - Installer::installShippedApps(false, $output); + // Install shipped apps and specified app bundles + $this->outputDebug($output, 'Install default apps'); + Installer::installShippedApps(false, $output); - // create empty file in data dir, so we can later find - // out that this is indeed an ownCloud data directory - $this->outputDebug($output, 'Setup data directory'); - file_put_contents($config->getSystemValueString('datadirectory', \OC::$SERVERROOT . '/data') . '/.ocdata', ''); + // create empty file in data dir, so we can later find + // out that this is indeed an ownCloud data directory + $this->outputDebug($output, 'Setup data directory'); + file_put_contents($config->getSystemValueString('datadirectory', \OC::$SERVERROOT . '/data') . '/.ocdata', ''); - // Update .htaccess files - self::updateHtaccess(); - self::protectDataDirectory(); + // Update .htaccess files + self::updateHtaccess(); + self::protectDataDirectory(); - $this->outputDebug($output, 'Install background jobs'); - self::installBackgroundJobs(); + $this->outputDebug($output, 'Install background jobs'); + self::installBackgroundJobs(); - //and we are done - $config->setSystemValue('installed', true); - if (self::shouldRemoveCanInstallFile()) { - unlink(\OC::$configDir.'/CAN_INSTALL'); - } - - $bootstrapCoordinator = \OCP\Server::get(\OC\AppFramework\Bootstrap\Coordinator::class); - $bootstrapCoordinator->runInitialRegistration(); + //and we are done + $config->setSystemValue('installed', true); + if (self::shouldRemoveCanInstallFile()) { + unlink(\OC::$configDir.'/CAN_INSTALL'); + } - // Create a session token for the newly created user - // The token provider requires a working db, so it's not injected on setup - /* @var $userSession User\Session */ - $userSession = \OC::$server->getUserSession(); - $provider = \OCP\Server::get(PublicKeyTokenProvider::class); - $userSession->setTokenProvider($provider); - $userSession->login($username, $password); - $userSession->createSessionToken($request, $userSession->getUser()->getUID(), $username, $password); + $bootstrapCoordinator = \OCP\Server::get(\OC\AppFramework\Bootstrap\Coordinator::class); + $bootstrapCoordinator->runInitialRegistration(); + + // Create a session token for the newly created user + // The token provider requires a working db, so it's not injected on setup + /** @var \OC\User\Session $userSession */ + $userSession = Server::get(IUserSession::class); + $provider = Server::get(PublicKeyTokenProvider::class); + $userSession->setTokenProvider($provider); + $userSession->login($username, $password); + $user = $userSession->getUser(); + if (!$user) { + $error[] = "No user found in session."; + return $error; + } + $userSession->createSessionToken($request, $user->getUID(), $username, $password); - $session = $userSession->getSession(); - $session->set('last-password-confirm', \OCP\Server::get(ITimeFactory::class)->getTime()); + $session = $userSession->getSession(); + $session->set('last-password-confirm', Server::get(ITimeFactory::class)->getTime()); - // Set email for admin - if (!empty($options['adminemail'])) { - $user->setSystemEMailAddress($options['adminemail']); - } + // Set email for admin + if (!empty($options['adminemail'])) { + $user->setSystemEMailAddress($options['adminemail']); } return $error; } - public static function installBackgroundJobs() { - $jobList = \OC::$server->getJobList(); + public static function installBackgroundJobs(): void { + $jobList = Server::get(IJobList::class); $jobList->add(TokenCleanupJob::class); $jobList->add(Rotate::class); $jobList->add(BackgroundCleanupJob::class); @@ -468,15 +455,13 @@ class Setup { /** * @return string Absolute path to htaccess */ - private function pathToHtaccess() { + private function pathToHtaccess(): string { return \OC::$SERVERROOT . '/.htaccess'; } /** * Find webroot from config * - * @param SystemConfig $config - * @return string * @throws InvalidArgumentException when invalid value for overwrite.cli.url */ private static function findWebRoot(SystemConfig $config): string { @@ -503,8 +488,8 @@ class Setup { * @return bool True when success, False otherwise * @throws \OCP\AppFramework\QueryException */ - public static function updateHtaccess() { - $config = \OC::$server->getSystemConfig(); + public static function updateHtaccess(): bool { + $config = Server::get(SystemConfig::class); try { $webRoot = self::findWebRoot($config); @@ -512,15 +497,7 @@ class Setup { return false; } - $setupHelper = new \OC\Setup( - $config, - \OC::$server->get(IniGetWrapper::class), - \OC::$server->getL10N('lib'), - \OCP\Server::get(Defaults::class), - \OC::$server->get(LoggerInterface::class), - \OC::$server->getSecureRandom(), - \OCP\Server::get(Installer::class) - ); + $setupHelper = Server::get(\OC\Setup::class); if (!is_writable($setupHelper->pathToHtaccess())) { return false; @@ -563,23 +540,19 @@ class Setup { $content .= "\n</IfModule>"; } - if ($content !== '') { - // Never write file back if disk space should be too low - if (function_exists('disk_free_space')) { - $df = disk_free_space(\OC::$SERVERROOT); - $size = strlen($content) + 10240; - if ($df !== false && $df < (float)$size) { - throw new \Exception(\OC::$SERVERROOT . " does not have enough space for writing the htaccess file! Not writing it back!"); - } + // Never write file back if disk space should be too low + if (function_exists('disk_free_space')) { + $df = disk_free_space(\OC::$SERVERROOT); + $size = strlen($content) + 10240; + if ($df !== false && $df < (float)$size) { + throw new \Exception(\OC::$SERVERROOT . " does not have enough space for writing the htaccess file! Not writing it back!"); } - //suppress errors in case we don't have permissions for it - return (bool)@file_put_contents($setupHelper->pathToHtaccess(), $htaccessContent . $content . "\n"); } - - return false; + //suppress errors in case we don't have permissions for it + return (bool)@file_put_contents($setupHelper->pathToHtaccess(), $htaccessContent . $content . "\n"); } - public static function protectDataDirectory() { + public static function protectDataDirectory(): void { //Require all denied $now = date('Y-m-d H:i:s'); $content = "# Generated by Nextcloud on $now\n"; @@ -607,7 +580,7 @@ class Setup { $content .= " IndexIgnore *\n"; $content .= "</IfModule>"; - $baseDir = \OC::$server->getConfig()->getSystemValueString('datadirectory', \OC::$SERVERROOT . '/data'); + $baseDir = Server::get(IConfig::class)->getSystemValueString('datadirectory', \OC::$SERVERROOT . '/data'); file_put_contents($baseDir . '/.htaccess', $content); file_put_contents($baseDir . '/index.html', ''); } @@ -623,17 +596,11 @@ class Setup { ]; } - /** - * @return bool - */ - public function shouldRemoveCanInstallFile() { + public function shouldRemoveCanInstallFile(): bool { return \OC_Util::getChannel() !== 'git' && is_file(\OC::$configDir.'/CAN_INSTALL'); } - /** - * @return bool - */ - public function canInstallFileExists() { + public function canInstallFileExists(): bool { return is_file(\OC::$configDir.'/CAN_INSTALL'); } diff --git a/lib/private/legacy/OC_App.php b/lib/private/legacy/OC_App.php index 6e4b40b4165..edd844bf89f 100644 --- a/lib/private/legacy/OC_App.php +++ b/lib/private/legacy/OC_App.php @@ -282,10 +282,8 @@ class OC_App { /** * Get the path where to install apps - * - * @return string|false */ - public static function getInstallPath() { + public static function getInstallPath(): string|null { foreach (OC::$APPSROOTS as $dir) { if (isset($dir['writable']) && $dir['writable'] === true) { return $dir['path']; diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php index f82ddcc78ee..c008ccd63ba 100644 --- a/lib/private/legacy/OC_Util.php +++ b/lib/private/legacy/OC_Util.php @@ -513,15 +513,7 @@ class OC_Util { } $webServerRestart = false; - $setup = new \OC\Setup( - $config, - \OC::$server->get(IniGetWrapper::class), - \OC::$server->getL10N('lib'), - \OC::$server->get(\OCP\Defaults::class), - \OC::$server->get(LoggerInterface::class), - \OC::$server->getSecureRandom(), - \OC::$server->get(\OC\Installer::class) - ); + $setup = \OCP\Server::get(\OC\Setup::class); $urlGenerator = \OC::$server->getURLGenerator(); |