Skip to content
Snippets Groups Projects
Commit 58206662 authored by Thomas Müller's avatar Thomas Müller
Browse files

Merge pull request #22218 from owncloud/occ-no-extra-messages

Add global --no-warnings option to occ…
parents 1106c354 972e0c62
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,7 @@
*/
use OC\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Output\ConsoleOutput;
define('OC_CONSOLE', 1);
......@@ -81,7 +82,7 @@ try {
}
$application = new Application(\OC::$server->getConfig(), \OC::$server->getEventDispatcher(), \OC::$server->getRequest());
$application->loadCommands(new ConsoleOutput());
$application->loadCommands(new ArgvInput(), new ConsoleOutput());
$application->run();
} catch (Exception $ex) {
echo "An unhandled exception has been thrown:" . PHP_EOL;
......
......@@ -31,6 +31,7 @@ use OCP\IRequest;
use Symfony\Component\Console\Application as SymfonyApplication;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
......@@ -56,12 +57,31 @@ class Application {
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @throws \Exception
*/
public function loadCommands(OutputInterface $output) {
public function loadCommands(InputInterface $input, OutputInterface $output) {
// $application is required to be defined in the register_command scripts
$application = $this->application;
$inputDefinition = $application->getDefinition();
$inputDefinition->addOption(
new InputOption(
'no-warnings',
null,
InputOption::VALUE_NONE,
'Skip global warnings, show command output only',
null
)
);
try {
$input->bind($inputDefinition);
} catch (\RuntimeException $e) {
//expected if there are extra options
}
if ($input->getOption('no-warnings')) {
$output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
}
require_once __DIR__ . '/../../../core/register_command.php';
if ($this->config->getSystemValue('installed', false)) {
if (\OCP\Util::needUpgrade()) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment