Skip to content

Commit

Permalink
Cleaned up the import command
Browse files Browse the repository at this point in the history
  • Loading branch information
Padam87 committed Jan 14, 2016
1 parent 3337b69 commit 41669c2
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions Command/ImportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Process\Process;

class ImportCommand extends ConfigurationAwareCommand
class ImportCommand extends DumpCommand
{
/**
* {@inheritdoc}
Expand All @@ -32,22 +32,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
{
parent::execute($input, $output);

$user = $input->getOption('user');
$group = $input->getOption('group');

$reader = new AnnotationReader();
$helper = new Helper($this->getApplication(), $reader);
$path = $this->dump($input);

$path = strtolower(
sprintf(
'%s/%s-%s.crontab',
sys_get_temp_dir(),
$this->getApplication()->getName(),
time()
)
);
$content = $helper->read($input, $group);
file_put_contents($path, (string) $content);
$user = $input->getOption('user');

$command = sprintf(
'crontab%s %s',
Expand All @@ -63,6 +50,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
$output->writeln($process->getErrorOutput());
}

unlink($path);

return $process->getExitCode();
}
}

0 comments on commit 41669c2

Please sign in to comment.