diff options
author | Côme Chilliet <91878298+come-nc@users.noreply.github.com> | 2024-09-13 16:21:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-13 16:21:44 +0200 |
commit | dfa994ef28e14b836169ddc0d6208e46123b07a2 (patch) | |
tree | 360d3935df63c053920fb80d54e8614780434c1e /lib/private | |
parent | a90f0a6b36deac85f7bbd8a0f04368ad30117637 (diff) | |
parent | d76745553c29897d9d7adb28b8d92a098783ca49 (diff) | |
download | nextcloud-server-dfa994ef28e14b836169ddc0d6208e46123b07a2.tar.gz nextcloud-server-dfa994ef28e14b836169ddc0d6208e46123b07a2.zip |
Merge pull request #47865 from nextcloud/admin_audit/enh/move-to-event-listeners-v2
Move admin_audit to proper event listeners v2
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/Console/Application.php | 25 | ||||
-rw-r--r-- | lib/private/Preview/Generator.php | 1 |
2 files changed, 16 insertions, 10 deletions
diff --git a/lib/private/Console/Application.php b/lib/private/Console/Application.php index 16ed8894386..22dc8d0c65e 100644 --- a/lib/private/Console/Application.php +++ b/lib/private/Console/Application.php @@ -7,14 +7,18 @@ */ namespace OC\Console; +use ArgumentCountError; use OC\MemoryInfo; use OC\NeedsUpdateException; +use OC\SystemConfig; use OCP\App\AppPathNotFoundException; use OCP\App\IAppManager; use OCP\Console\ConsoleEvent; +use OCP\Defaults; use OCP\EventDispatcher\IEventDispatcher; use OCP\IConfig; use OCP\IRequest; +use OCP\Server; use Psr\Container\ContainerExceptionInterface; use Psr\Log\LoggerInterface; use Symfony\Component\Console\Application as SymfonyApplication; @@ -33,8 +37,8 @@ class Application { private LoggerInterface $logger, private MemoryInfo $memoryInfo, private IAppManager $appManager, + private Defaults $defaults, ) { - $defaults = \OC::$server->get('ThemingDefaults'); $this->application = new SymfonyApplication($defaults->getName(), \OC_Util::getVersionString()); } @@ -44,7 +48,7 @@ class Application { public function loadCommands( InputInterface $input, ConsoleOutputInterface $output - ) { + ): void { // $application is required to be defined in the register_command scripts $application = $this->application; $inputDefinition = $application->getDefinition(); @@ -118,7 +122,7 @@ class Application { $errorOutput = $output->getErrorOutput(); $errorOutput->writeln('Nextcloud is not installed - only a limited number of commands are available'); } - } catch (NeedsUpdateException $e) { + } catch (NeedsUpdateException) { if ($input->getArgument('command') !== '_completion') { $errorOutput = $output->getErrorOutput(); $errorOutput->writeln('Nextcloud or one of the apps require upgrade - only a limited number of commands are available'); @@ -127,7 +131,7 @@ class Application { } if ($input->getFirstArgument() !== 'check') { - $errors = \OC_Util::checkServer(\OC::$server->getSystemConfig()); + $errors = \OC_Util::checkServer(Server::get(SystemConfig::class)); if (!empty($errors)) { foreach ($errors as $error) { $output->writeln((string)$error['error']); @@ -163,13 +167,11 @@ class Application { * * @param bool $boolean Whether to automatically exit after a command execution or not */ - public function setAutoExit($boolean) { + public function setAutoExit(bool $boolean): void { $this->application->setAutoExit($boolean); } /** - * @param InputInterface $input - * @param OutputInterface $output * @return int * @throws \Exception */ @@ -183,15 +185,18 @@ class Application { return $this->application->run($input, $output); } - private function loadCommandsFromInfoXml($commands) { + /** + * @throws \Exception + */ + private function loadCommandsFromInfoXml(iterable $commands): void { foreach ($commands as $command) { try { - $c = \OCP\Server::get($command); + $c = Server::get($command); } catch (ContainerExceptionInterface $e) { if (class_exists($command)) { try { $c = new $command(); - } catch (\ArgumentCountError $e2) { + } catch (ArgumentCountError) { throw new \Exception("Failed to construct console command '$command': " . $e->getMessage(), 0, $e); } } else { diff --git a/lib/private/Preview/Generator.php b/lib/private/Preview/Generator.php index 460637c9a99..c7eb3121825 100644 --- a/lib/private/Preview/Generator.php +++ b/lib/private/Preview/Generator.php @@ -80,6 +80,7 @@ class Generator { $height, $crop, $mode, + $mimeType, )); // since we only ask for one preview, and the generate method return the last one it created, it returns the one we want |