tx-cli: command to receive envelopes on the local branch.

skala
Marco Villegas 12 years ago
parent 33c4cce4ba
commit 7ea390c0e0
  1. 1
      console.php
  2. 31
      src/ChamiloLMS/Command/Transaction/ReceiveCommand.php

@ -77,6 +77,7 @@ $cli->addCommands(
new ChamiloLMS\Command\Template\AsseticDumpCommand(),
new ChamiloLMS\Command\Transaction\ImportToSystemCommand(),
new ChamiloLMS\Command\Transaction\ReceiveCommand(),
new ChamiloLMS\Command\Transaction\SendCommand(),
new ChamiloLMS\Command\Transaction\MineduSendCommand(),
new ChamiloLMS\Command\Translation\ExportLanguagesCommand(),

@ -0,0 +1,31 @@
<?php
namespace ChamiloLMS\Command\Transaction;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use ChamiloLMS\Transaction\TransactionLogController;
class ReceiveCommand extends Command
{
protected function configure()
{
$this
->setName('tx:receive')
->setDescription('Runs local branch associated receive plugin processing envelope reception.')
->addOption('limit', null, InputOption::VALUE_OPTIONAL, 'The maximum number of envelopes to receive in this operation.', 1);
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$tc = new TransactionLogController();
$limit = (int) $input->getOption('limit');
if ($limit <= 0) {
$limit = 1;
}
$envelopes = $tc->receiveEnvelopeData($limit);
$output->writeln(sprintf('Correctly received (%d) envelopes now added to the queue.', count($envelopes)));
}
}
Loading…
Cancel
Save