refactor commands

This commit is contained in:
Nicolas Le Goff
2012-06-01 11:39:58 +02:00
parent be1f81d39b
commit 20fc38bb5d
24 changed files with 34 additions and 81 deletions

View File

@@ -33,9 +33,7 @@ class module_console_aboutAuthors extends Command
public function execute(InputInterface $input, OutputInterface $output)
{
if ( ! $this->checkSetup($output)) {
return 1;
}
$this->checkSetup();
$output->writeln(file_get_contents(__DIR__ . '/../../../../AUTHORS'));

View File

@@ -33,9 +33,7 @@ class module_console_aboutLicense extends Command
public function execute(InputInterface $input, OutputInterface $output)
{
if ( ! $this->checkSetup($output)) {
return 1;
}
$this->checkSetup();
$output->writeln(file_get_contents(__DIR__ . '/../../../../LICENSE'));

View File

@@ -43,9 +43,7 @@ class module_console_checkExtension extends Command
public function execute(InputInterface $input, OutputInterface $output)
{
if ( ! $this->checkSetup($output)) {
return 1;
}
$this->checkSetup();
if ( ! extension_loaded('phrasea2')) {
$output->writeln("<error>Missing Extension php-phrasea.</error>");

View File

@@ -42,9 +42,7 @@ class module_console_fieldsDelete extends Command
public function execute(InputInterface $input, OutputInterface $output)
{
if ( ! $this->checkSetup($output)) {
return 1;
}
$this->checkSetup();
try {
$databox = \databox::get_instance((int) $input->getArgument('sbas_id'));

View File

@@ -38,9 +38,7 @@ class module_console_fieldsList extends Command
public function execute(InputInterface $input, OutputInterface $output)
{
if ( ! $this->checkSetup($output)) {
return 1;
}
$this->checkSetup();
$appbox = \appbox::get_instance(\bootstrap::getCore());

View File

@@ -52,9 +52,7 @@ class module_console_fieldsMerge extends Command
public function execute(InputInterface $input, OutputInterface $output)
{
if ( ! $this->checkSetup($output)) {
return 1;
}
$this->checkSetup();
$output->writeln("");

View File

@@ -43,9 +43,7 @@ class module_console_fieldsRename extends Command
public function execute(InputInterface $input, OutputInterface $output)
{
if ( ! $this->checkSetup($output)) {
return 1;
}
$this->checkSetup();
$new_name = $input->getArgument('name');

View File

@@ -62,9 +62,7 @@ class module_console_fileEnsureDevSetting extends Command
public function execute(InputInterface $input, OutputInterface $output)
{
if ( ! $this->checkSetup($output)) {
return 1;
}
$this->checkSetup();
$specifications = new \Alchemy\Phrasea\Core\Configuration\ApplicationSpecification();

View File

@@ -62,9 +62,7 @@ class module_console_fileEnsureProductionSetting extends Command
public function execute(InputInterface $input, OutputInterface $output)
{
if ( ! $this->checkSetup($output)) {
return 1;
}
$this->checkSetup();
$specifications = new \Alchemy\Phrasea\Core\Configuration\ApplicationSpecification();

View File

@@ -41,9 +41,7 @@ class module_console_schedulerStart extends Command
public function execute(InputInterface $input, OutputInterface $output)
{
if ( ! $this->checkSetup($output)) {
return 1;
}
$this->checkSetup();
$logger = new Logger('Task logger');

View File

@@ -56,8 +56,9 @@ class module_console_schedulerState extends Command
public function execute(InputInterface $input, OutputInterface $output)
{
if ( ! $this->checkSetup($output)) {
try{
$this->checkSetup();
} catch (\RuntimeException $e){
return self::EXITCODE_SETUP_ERROR;
}

View File

@@ -38,10 +38,7 @@ class module_console_schedulerStop extends Command
public function execute(InputInterface $input, OutputInterface $output)
{
if ( ! $this->checkSetup($output)) {
return 1;
}
$this->checkSetup();
require_once __DIR__ . '/../../../../lib/bootstrap.php';

View File

@@ -39,10 +39,7 @@ class module_console_sphinxGenerateSuggestion extends Command
public function execute(InputInterface $input, OutputInterface $output)
{
if ( ! $this->checkSetup($output)) {
return 1;
}
$this->checkSetup();
define('FREQ_THRESHOLD', 10);
define('SUGGEST_DEBUG', 0);

View File

@@ -45,10 +45,7 @@ class module_console_systemBackupDB extends Command
public function execute(InputInterface $input, OutputInterface $output)
{
if ( ! $this->checkSetup($output)) {
return 1;
}
$this->checkSetup();
$output->write('Phraseanet is going to be backup...', true);

View File

@@ -39,10 +39,7 @@ class module_console_systemClearCache extends Command
public function execute(InputInterface $input, OutputInterface $output)
{
if ( ! $this->checkSetup($output)) {
return 1;
}
$this->checkSetup();
$finder = new Finder();

View File

@@ -39,10 +39,7 @@ class module_console_systemConfigCheck extends Command
public function execute(InputInterface $input, OutputInterface $output)
{
if ( ! $this->checkSetup($output)) {
return 1;
}
$this->checkSetup();
if ( ! function_exists('_')) {
$output->writeln('<error>YOU MUST ENABLE GETTEXT SUPPORT TO USE PHRASEANET</error>');

View File

@@ -78,10 +78,7 @@ class module_console_systemExport extends Command
public function execute(InputInterface $input, OutputInterface $output)
{
if ( ! $this->checkSetup($output)) {
return 1;
}
$this->checkSetup();
$core = \bootstrap::getCore();

View File

@@ -44,10 +44,7 @@ class module_console_systemMailCheck extends Command
public function execute(InputInterface $input, OutputInterface $output)
{
if ( ! $this->checkSetup($output)) {
return 1;
}
$this->checkSetup();
$appbox = appbox::get_instance(\bootstrap::getCore());

View File

@@ -38,10 +38,7 @@ class module_console_systemTemplateGenerator extends Command
public function execute(InputInterface $input, OutputInterface $output)
{
if ( ! $this->checkSetup($output)) {
return 1;
}
$this->checkSetup();
$tplDirs = array(
realpath(__DIR__ . '/../../../../templates/web/'),

View File

@@ -39,10 +39,7 @@ class module_console_systemUpgrade extends Command
public function execute(InputInterface $input, OutputInterface $output)
{
if ( ! $this->checkSetup($output)) {
return 1;
}
$this->checkSetup();
$Core = \bootstrap::getCore();

View File

@@ -64,8 +64,9 @@ class module_console_taskState extends Command
public function execute(InputInterface $input, OutputInterface $output)
{
if ( ! $this->checkSetup($output)) {
try{
$this->checkSetup();
} catch (\RuntimeException $e){
return self::EXITCODE_SETUP_ERROR;
}

View File

@@ -39,8 +39,9 @@ class module_console_tasklist extends Command
public function execute(InputInterface $input, OutputInterface $output)
{
if ( ! $this->checkSetup($output)) {
try{
$this->checkSetup();
} catch (\RuntimeException $e){
return self::EXITCODE_SETUP_ERROR;
}

View File

@@ -72,8 +72,9 @@ class module_console_taskrun extends Command
public function execute(InputInterface $input, OutputInterface $output)
{
if ( ! $this->checkSetup($output)) {
try{
$this->checkSetup();
} catch (\RuntimeException $e){
return self::EXITCODE_SETUP_ERROR;
}