Security update for Core, with self-updated composer
[yaffs-website] / vendor / drupal / console / src / Command / Update / EntitiesCommand.php
index 85b5007a46cf1ded093af2d4cd1f582112c2968a..f77fbad134dafbac144afd79dbc2eba7e1d777e8 100644 (file)
@@ -9,11 +9,9 @@ namespace Drupal\Console\Command\Update;
 
 use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
-use Symfony\Component\Console\Command\Command;
-use Drupal\Console\Core\Command\Shared\CommandTrait;
+use Drupal\Console\Core\Command\Command;
 use Drupal\Core\Entity\EntityStorageException;
 use Drupal\Core\Utility\Error;
-use Drupal\Console\Core\Style\DrupalStyle;
 use Drupal\Core\State\StateInterface;
 use Drupal\Core\Entity\EntityDefinitionUpdateManager;
 use Drupal\Console\Core\Utils\ChainQueue;
@@ -25,8 +23,6 @@ use Drupal\Console\Core\Utils\ChainQueue;
  */
 class EntitiesCommand extends Command
 {
-    use CommandTrait;
-
     /**
      * @var StateInterface
      */
@@ -67,7 +63,9 @@ class EntitiesCommand extends Command
     {
         $this
             ->setName('update:entities')
-            ->setDescription($this->trans('commands.update.entities.description'));
+            ->setDescription($this->trans('commands.update.entities.description'))
+            ->setAliases(['upe']);
+        ;
     }
 
     /**
@@ -75,11 +73,9 @@ class EntitiesCommand extends Command
      */
     protected function execute(InputInterface $input, OutputInterface $output)
     {
-        $io = new DrupalStyle($input, $output);
-
         //$state = $this->getDrupalService('state');
-        $io->info($this->trans('commands.site.maintenance.messages.maintenance-on'));
-        $io->info($this->trans('commands.update.entities.messages.start'));
+        $this->getIo()->info($this->trans('commands.site.maintenance.messages.maintenance-on'));
+        $this->getIo()->info($this->trans('commands.update.entities.messages.start'));
         $this->state->set('system.maintenance_mode', true);
 
         try {
@@ -88,13 +84,13 @@ class EntitiesCommand extends Command
         } catch (EntityStorageException $e) {
             /* @var Error $variables */
             $variables = Error::decodeException($e);
-            $io->info($this->trans('commands.update.entities.messages.error'));
-            $io->info($variables);
+            $this->getIo()->errorLite($this->trans('commands.update.entities.messages.error'));
+            $this->getIo()->error(strtr('%type: @message in %function (line %line of %file).', $variables));
         }
 
         $this->state->set('system.maintenance_mode', false);
-        $io->info($this->trans('commands.update.entities.messages.end'));
+        $this->getIo()->info($this->trans('commands.update.entities.messages.end'));
         $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']);
-        $io->info($this->trans('commands.site.maintenance.messages.maintenance-off'));
+        $this->getIo()->info($this->trans('commands.site.maintenance.messages.maintenance-off'));
     }
 }