Пример #1
0
 /**
  * @param InputInterface  $input
  * @param OutputInterface $output
  *
  * @return null
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $name = $input->getArgument('name');
     $user = $input->getOption('user');
     $crontab = new Crontab($user, $name);
     $systemReader = new SystemReader($user, $crontab);
     $systemReader->read();
     $crontab->clearManagedTasks();
     $this->output($output, $crontab, $user);
 }
Пример #2
0
 /**
  * @param InputInterface  $input
  * @param OutputInterface $output
  *
  * @return null
  * @SuppressWarnings(PHPMD.StaticAccess)
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $name = $input->getArgument('name');
     $user = $input->getOption('user');
     $crontab = new Crontab($user, $name);
     $systemReader = new SystemReader($user, $crontab);
     $systemReader->read();
     $configuration = $this->prepareConfiguration($input);
     $configuration['crontab'] = $crontab;
     /** @var ReaderInterface $reader */
     $reader = ReaderFactory::create($configuration);
     try {
         $crontab = $reader->read();
     } catch (ParsingException $e) {
         $output->writeln(sprintf("<error>File '%s' does not have --type=%s or has error in formatting.</error>", $configuration['file'], $configuration['type']));
         return 1;
     }
     $this->output($output, $crontab, $user);
 }