Browse Source

fix: use DI to build main Application class in console.php

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
pull/44025/head
Côme Chilliet 2 months ago
parent
commit
8c5f32320a
No account linked to committer's email address
2 changed files with 6 additions and 10 deletions
  1. 5
    9
      console.php
  2. 1
    1
      core/Command/App/Remove.php

+ 5
- 9
console.php View File

<?php <?php

declare(strict_types=1);

/** /**
* @copyright Copyright (c) 2016, ownCloud, Inc. * @copyright Copyright (c) 2016, ownCloud, Inc.
* *
exit(1); exit(1);
} }


$config = \OC::$server->getConfig();
$config = \OCP\Server::get(\OCP\IConfig::class);
set_exception_handler('exceptionHandler'); set_exception_handler('exceptionHandler');


if (!function_exists('posix_getuid')) { if (!function_exists('posix_getuid')) {
echo "Additionally the function 'pcntl_signal' and 'pcntl_signal_dispatch' need to be enabled in your php.ini." . PHP_EOL; echo "Additionally the function 'pcntl_signal' and 'pcntl_signal_dispatch' need to be enabled in your php.ini." . PHP_EOL;
} }


$application = new Application(
$config,
\OC::$server->get(\OCP\EventDispatcher\IEventDispatcher::class),
\OC::$server->getRequest(),
\OC::$server->get(\Psr\Log\LoggerInterface::class),
\OC::$server->query(\OC\MemoryInfo::class),
\OCP\Server::get(\OCP\App\IAppManager::class),
);
$application = \OCP\Server::get(Application::class);
$application->loadCommands(new ArgvInput(), new ConsoleOutput()); $application->loadCommands(new ArgvInput(), new ConsoleOutput());
$application->run(); $application->run();
} catch (Exception $ex) { } catch (Exception $ex) {

+ 1
- 1
core/Command/App/Remove.php View File

*/ */
public function completeArgumentValues($argumentName, CompletionContext $context): array { public function completeArgumentValues($argumentName, CompletionContext $context): array {
if ($argumentName === 'app-id') { if ($argumentName === 'app-id') {
return $this->appManager->getInstalledApps();
return $this->manager->getInstalledApps();
} }
return []; return [];
} }

Loading…
Cancel
Save