Added secure tests for the drop database command

This commit is contained in:
William DURAND 2011-06-22 17:27:57 +02:00
commit e27dc9cbd5

View file

@ -45,6 +45,14 @@ EOT
protected function execute(InputInterface $input, OutputInterface $output)
{
if ($input->getOption('force')) {
if ('prod' === $this->getApplication()->getKernel()->getEnvironment()) {
$this->writeSection($output, 'WARNING: you are about to drop a database in production !', 'bg=red;fg=white');
if (false === $this->askConfirmation($output, 'Are you sure ? (y/n) ', false)) {
$output->writeln('Aborted, nice decision !');
return -2;
}
}
$this->writeSection($output, '[Propel] You are running the command: propel:database:drop');
list($name, $config) = $this->getConnection($input, $output);