1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/16955] Use constants for exit codes in installer console commands

PHPBB3-16955
This commit is contained in:
Marc Alexander
2022-12-30 17:28:17 +01:00
parent fab81eca2b
commit 3b8f6ae4e9
6 changed files with 34 additions and 28 deletions

View File

@@ -18,6 +18,7 @@ use phpbb\install\updater_configuration;
use phpbb\language\language;
use Symfony\Component\Config\Definition\Exception\Exception;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@@ -90,7 +91,7 @@ class show extends \phpbb\console\command\command
{
$iohandler->add_error_message(array('MISSING_FILE', $config_file));
return 1;
return Command::FAILURE;
}
try
@@ -101,7 +102,7 @@ class show extends \phpbb\console\command\command
{
$iohandler->add_error_message('INVALID_YAML_FILE');
return 1;
return Command::FAILURE;
}
$processor = new Processor();
@@ -115,11 +116,11 @@ class show extends \phpbb\console\command\command
{
$iohandler->add_error_message('INVALID_CONFIGURATION', $e->getMessage());
return 1;
return Command::FAILURE;
}
$style->block(Yaml::dump(array('updater' => $config), 10, 4, true, false));
return 0;
return Command::SUCCESS;
}
}

View File

@@ -18,6 +18,7 @@ use phpbb\install\updater_configuration;
use phpbb\language\language;
use Symfony\Component\Config\Definition\Exception\Exception;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@@ -90,7 +91,7 @@ class validate extends \phpbb\console\command\command
{
$iohandler->add_error_message(array('MISSING_FILE', array($config_file)));
return 1;
return Command::FAILURE;
}
try
@@ -101,7 +102,7 @@ class validate extends \phpbb\console\command\command
{
$iohandler->add_error_message('INVALID_YAML_FILE');
return 1;
return Command::FAILURE;
}
$processor = new Processor();
@@ -115,10 +116,10 @@ class validate extends \phpbb\console\command\command
{
$iohandler->add_error_message('INVALID_CONFIGURATION', $e->getMessage());
return 1;
return Command::FAILURE;
}
$iohandler->add_success_message('CONFIGURATION_VALID');
return 0;
return Command::SUCCESS;
}
}