Security update for Core, with self-updated composer
[yaffs-website] / vendor / drupal / console / src / Command / Module / UpdateCommand.php
index a443fa8515f824ad86791d9e36d24c50e85a8e24..45b04a57a33107e552dcbe6e49cd613a7c80a315 100644 (file)
@@ -7,19 +7,16 @@
 
 namespace Drupal\Console\Command\Module;
 
-use Drupal\Console\Core\Command\Shared\CommandTrait;
 use Symfony\Component\Console\Input\InputArgument;
 use Symfony\Component\Console\Input\InputOption;
 use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
-use Symfony\Component\Console\Command\Command;
-use Drupal\Console\Core\Style\DrupalStyle;
+use Drupal\Console\Core\Command\Command;
 use Drupal\Console\Command\Shared\ProjectDownloadTrait;
 use Drupal\Console\Core\Utils\ShellProcess;
 
 class UpdateCommand extends Command
 {
-    use CommandTrait;
     use ProjectDownloadTrait;
 
 
@@ -68,7 +65,7 @@ class UpdateCommand extends Command
                 null,
                 InputOption::VALUE_NONE,
                 $this->trans('commands.module.update.options.simulate')
-            );
+            )->setAliases(['moup']);
     }
 
     /**
@@ -76,18 +73,17 @@ class UpdateCommand extends Command
      */
     protected function interact(InputInterface $input, OutputInterface $output)
     {
-        $io = new DrupalStyle($input, $output);
         $composer = $input->getOption('composer');
         $module = $input->getArgument('module');
 
         if (!$composer) {
-            $io->error($this->trans('commands.module.update.messages.only-composer'));
+            $this->getIo()->error($this->trans('commands.module.update.messages.only-composer'));
 
             return 1;
         }
 
         if (!$module) {
-            $module = $this->modulesQuestion($io);
+            $module = $this->modulesQuestion();
             $input->setArgument('module', $module);
         }
     }
@@ -97,20 +93,18 @@ class UpdateCommand extends Command
      */
     protected function execute(InputInterface $input, OutputInterface $output)
     {
-        $io = new DrupalStyle($input, $output);
-
         $modules = $input->getArgument('module');
         $composer = $input->getOption('composer');
         $simulate = $input->getOption('simulate');
 
         if (!$composer) {
-            $io->error($this->trans('commands.module.update.messages.only-composer'));
+            $this->getIo()->error($this->trans('commands.module.update.messages.only-composer'));
 
             return 1;
         }
 
         if (!$modules) {
-            $io->error(
+            $this->getIo()->error(
                 $this->trans('commands.module.update.messages.missing-module')
             );
 
@@ -125,7 +119,7 @@ class UpdateCommand extends Command
 
         if ($composer) {
             // Register composer repository
-            $command = "composer config repositories.drupal composer https://packagist.drupal-composer.org";
+            $command = "composer config repositories.drupal composer https://packages.drupal.org/8";
             $this->shellProcess->exec($command, $this->root);
 
             $command = 'composer update ' . $modules . ' --optimize-autoloader --prefer-dist --no-dev --root-reqs ';
@@ -135,7 +129,7 @@ class UpdateCommand extends Command
             }
 
             if ($this->shellProcess->exec($command, $this->root)) {
-                $io->success(
+                $this->getIo()->success(
                     sprintf(
                         $this->trans('commands.module.update.messages.composer'),
                         trim($modules)