This commit is contained in:
Romain Neutron
2012-04-26 00:55:53 +02:00
parent edbfff226e
commit ade22295ad
631 changed files with 92375 additions and 101763 deletions

View File

@@ -26,56 +26,49 @@ use Symfony\Component\Console\Command\Command;
class module_console_tasklist extends Command
{
public function __construct($name = null)
{
parent::__construct($name);
$this->setDescription('List tasks');
return $this;
}
public function execute(InputInterface $input, OutputInterface $output)
{
if (!setup::is_installed())
public function __construct($name = null)
{
$output->writeln('Phraseanet is not set up');
parent::__construct($name);
return 1;
$this->setDescription('List tasks');
return $this;
}
require_once __DIR__ . '/../../../../lib/bootstrap.php';
try
public function execute(InputInterface $input, OutputInterface $output)
{
$appbox = appbox::get_instance(\bootstrap::getCore());
$task_manager = new task_manager($appbox);
$tasks = $task_manager->get_tasks();
if ( ! setup::is_installed()) {
$output->writeln('Phraseanet is not set up');
if (count($tasks) === 0)
{
$output->writeln('No tasks on your install !');
}
return 1;
}
foreach ($tasks as $task)
{
$this->print_task($task, $output);
}
require_once __DIR__ . '/../../../../lib/bootstrap.php';
return 0;
try {
$appbox = appbox::get_instance(\bootstrap::getCore());
$task_manager = new task_manager($appbox);
$tasks = $task_manager->get_tasks();
if (count($tasks) === 0) {
$output->writeln('No tasks on your install !');
}
foreach ($tasks as $task) {
$this->print_task($task, $output);
}
return 0;
} catch (\Exception $e) {
return 1;
}
}
catch (\Exception $e)
protected function print_task(task_abstract $task, OutputInterface &$output)
{
return 1;
$message = $task->get_task_id() . "\t" . ($task->get_status() ) . "\t" . $task->get_title();
$output->writeln($message);
return $this;
}
}
protected function print_task(task_abstract $task, OutputInterface &$output)
{
$message = $task->get_task_id() . "\t" . ($task->get_status() ) . "\t" . $task->get_title();
$output->writeln($message);
return $this;
}
}