Coding Standards

This commit is contained in:
Romain Neutron
2012-02-13 18:23:06 +01:00
parent bc9470290b
commit 8a154e21c1
40 changed files with 99 additions and 63 deletions

View File

@@ -87,6 +87,7 @@ class module_console_fileConfigCheck extends Command
if (!$this->configuration->isInstalled())
{
$output->writeln(sprintf("\nPhraseanet is not installed\n"));
return 1;
}
}
@@ -102,7 +103,7 @@ class module_console_fileConfigCheck extends Command
catch (\Exception $e)
{
$previous = $e->getPrevious();
$output->writeln(sprintf(
"<error>%s FATAL error : %s</error>"
, $e->getMessage()
@@ -111,6 +112,7 @@ class module_console_fileConfigCheck extends Command
)
);
$output->writeln(sprintf("\nConfig check test suite can not continue please correct FATAL error and relaunch.\n"));
return 1;
}
}
@@ -138,6 +140,7 @@ class module_console_fileConfigCheck extends Command
);
}
}
return (int) ($nbErrors > 0);
}

View File

@@ -25,7 +25,7 @@ use Alchemy\Phrasea\Core;
*/
class module_console_fileEnsureProductionSetting extends Command
{
const ALERT = 1;
const ERROR = 0;
@@ -80,6 +80,7 @@ class module_console_fileEnsureProductionSetting extends Command
if (!$this->configuration->isInstalled())
{
$output->writeln(sprintf("\nPhraseanet is not installed\n"));
return 1;
}
}
@@ -104,6 +105,7 @@ class module_console_fileEnsureProductionSetting extends Command
)
);
$output->writeln(sprintf("\nCheck test suite can not continue please correct FATAL error and relaunch.\n"));
return 1;
}
}

View File

@@ -44,12 +44,13 @@ class module_console_schedulerStart extends Command
if (!setup::is_installed())
{
$output->writeln('Phraseanet is not set up');
return 1;
}
require_once __DIR__ . '/../../../../lib/bootstrap.php';
try
{
$scheduler = new task_Scheduler();

View File

@@ -39,6 +39,7 @@ class module_console_schedulerState extends Command
if (!setup::is_installed())
{
$output->writeln('Phraseanet is not set up');
return 1;
}
@@ -61,6 +62,7 @@ class module_console_schedulerState extends Command
{
$output->writeln(sprintf('Scheduler is %s', $state['schedstatus']));
}
return 0;
}
catch(\Exception $e)

View File

@@ -39,6 +39,7 @@ class module_console_schedulerStop extends Command
if (!setup::is_installed())
{
$output->writeln('Phraseanet is not set up');
return 1;
}
@@ -49,6 +50,7 @@ class module_console_schedulerStop extends Command
$appbox = appbox::get_instance();
$task_manager = new task_manager($appbox);
$task_manager->set_sched_status(task_manager::STATUS_SCHED_TOSTOP);
return 0;
}
catch (\Exception $e)

View File

@@ -46,6 +46,7 @@ class module_console_systemBackupDB extends Command
if (!setup::is_installed())
{
$output->writeln('Argument must be an Id.');
return 1;
}
@@ -56,7 +57,7 @@ class module_console_systemBackupDB extends Command
$appbox = appbox::get_instance();
$ok = true;
$ok = $this->dump_base($appbox, $input, $output) && $ok;
foreach ($appbox->get_databoxes() as $databox)
@@ -96,15 +97,17 @@ class module_console_systemBackupDB extends Command
if (file_exists($filename) && filesize($filename) > 0)
{
$output->writeln('OK');
return true;
}
else
{
$output->writeln('<error>Failed</error>');
return false;
}
}
}

View File

@@ -47,7 +47,7 @@ class module_console_systemClearCache extends Command
__DIR__ . '/../../../../tmp/cache_minify/'
, __DIR__ . '/../../../../tmp/cache_twig/'
));
$count = 1;
foreach ($finder as $file)
{
@@ -64,7 +64,7 @@ class module_console_systemClearCache extends Command
))
->exclude('.git')
->exclude('.svn');
foreach ($finder as $file)
{
$dirs[$file->getPathname()] = $file->getPathname();

View File

@@ -46,7 +46,7 @@ class module_console_systemConfigCheck extends Command
}
$ok = true;
if (setup::is_installed())
{
$registry = registry::get_instance();
@@ -60,7 +60,7 @@ class module_console_systemConfigCheck extends Command
$registry = new Setup_Registry();
}
$output->writeln(_('*** FILESYSTEM CONFIGURATION ***'));
$ok = $this->processConstraints(setup::check_writability($registry), $output) && $ok;
@@ -99,6 +99,7 @@ class module_console_systemConfigCheck extends Command
$hasError = true;
}
}
return !$hasError;
}
@@ -118,6 +119,7 @@ class module_console_systemConfigCheck extends Command
{
$output->writeln("\t/!\\\t<comment>" . $constraint->get_message() . '</comment>');
}
return $ok;
}

View File

@@ -40,6 +40,7 @@ class module_console_tasklist extends Command
if (!setup::is_installed())
{
$output->writeln('Phraseanet is not set up');
return 1;
}
@@ -60,6 +61,7 @@ class module_console_tasklist extends Command
{
$this->print_task($task, $output);
}
return 0;
}
catch (\Exception $e)

View File

@@ -48,6 +48,7 @@ class module_console_taskrun extends Command
if (!setup::is_installed())
{
$output->writeln('Phraseanet is not set up');
return 1;
}
@@ -58,6 +59,7 @@ class module_console_taskrun extends Command
if ($task_id <= 0 || strlen($task_id) !== strlen($input->getArgument('task_id')))
{
$output->writeln('Argument must be an Id.');
return 1;
}
@@ -73,9 +75,9 @@ class module_console_taskrun extends Command
{
$runner = task_abstract::RUNNER_MANUAL;
}
$task->run($runner);
return 0;
}
catch (\exception $e)