Security update for Core, with self-updated composer
[yaffs-website] / vendor / drupal / console / src / Command / Database / AddCommand.php
index 1e2087a10eb2f94cccaa7da5f2862e628f3f5c64..a83ba00796da728aae7a30c841978fd28bbb3d1a 100644 (file)
@@ -7,21 +7,14 @@
 
 namespace Drupal\Console\Command\Database;
 
-use Symfony\Component\Console\Input\InputArgument;
 use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Input\InputOption;
 use Symfony\Component\Console\Output\OutputInterface;
-use Symfony\Component\Console\Command\Command;
+use Drupal\Console\Core\Command\Command;
 use Drupal\Console\Generator\DatabaseSettingsGenerator;
-use Drupal\Console\Core\Command\Shared\CommandTrait;
-use Drupal\Console\Command\Shared\ConnectTrait;
-use Drupal\Console\Core\Style\DrupalStyle;
 
 class AddCommand extends Command
 {
-    use CommandTrait;
-    use ConnectTrait;
-
 
     /**
      * @var DatabaseSettingsGenerator
@@ -90,19 +83,19 @@ class AddCommand extends Command
                 InputOption::VALUE_OPTIONAL,
                 $this->trans('commands.database.add.options.driver')
             )
-            ->setHelp($this->trans('commands.database.add.help'));
+            ->setHelp($this->trans('commands.database.add.help'))
+            ->setAliases(['dba']);
     }
     /**
      * {@inheritdoc}
      */
     protected function execute(InputInterface $input, OutputInterface $output)
     {
-        $io = new DrupalStyle($input, $output);
         $result = $this
             ->generator
             ->generate($input->getOptions());
         if (!$result) {
-            $io->error($this->trans('commands.database.add.error'));
+            $this->getIo()->error($this->trans('commands.database.add.error'));
         }
     }
 
@@ -111,11 +104,9 @@ class AddCommand extends Command
      */
     protected function interact(InputInterface $input, OutputInterface $output)
     {
-        $io = new DrupalStyle($input, $output);
-
         $database = $input->getOption('database');
         if (!$database) {
-            $database = $io->ask(
+            $database = $this->getIo()->ask(
                 $this->trans('commands.database.add.questions.database'),
                 'migrate_db'
             );
@@ -123,7 +114,7 @@ class AddCommand extends Command
         $input->setOption('database', $database);
         $username = $input->getOption('username');
         if (!$username) {
-            $username = $io->ask(
+            $username = $this->getIo()->ask(
                 $this->trans('commands.database.add.questions.username'),
                 ''
             );
@@ -131,7 +122,7 @@ class AddCommand extends Command
         $input->setOption('username', $username);
         $password = $input->getOption('password');
         if (!$password) {
-            $password = $io->ask(
+            $password = $this->getIo()->ask(
                 $this->trans('commands.database.add.questions.password'),
                 ''
             );
@@ -139,7 +130,7 @@ class AddCommand extends Command
         $input->setOption('password', $password);
         $prefix = $input->getOption('prefix');
         if (!$prefix) {
-            $prefix = $io->ask(
+            $prefix = $this->getIo()->ask(
                 $this->trans('commands.database.add.questions.prefix'),
                 false
             );
@@ -147,7 +138,7 @@ class AddCommand extends Command
         $input->setOption('prefix', $prefix);
         $host = $input->getOption('host');
         if (!$host) {
-            $host = $io->ask(
+            $host = $this->getIo()->ask(
                 $this->trans('commands.database.add.questions.host'),
                 'localhost'
             );
@@ -155,7 +146,7 @@ class AddCommand extends Command
         $input->setOption('host', $host);
         $port = $input->getOption('port');
         if (!$port) {
-            $port = $io->ask(
+            $port = $this->getIo()->ask(
                 $this->trans('commands.database.add.questions.port'),
                 3306
             );
@@ -163,7 +154,7 @@ class AddCommand extends Command
         $input->setOption('port', $port);
         $driver = $input->getOption('driver');
         if (!$driver) {
-            $driver = $io->ask(
+            $driver = $this->getIo()->ask(
                 $this->trans('commands.database.add.questions.driver'),
                 'mysql'
             );