Security update for Core, with self-updated composer
[yaffs-website] / vendor / drupal / console / src / Command / Node / AccessRebuildCommand.php
index b950e2d6573a0c92d1e1939507499d9e0a493a2d..c1bbd9425feeabd49ebaedefca3ba591b5120d6b 100644 (file)
@@ -10,10 +10,8 @@ namespace Drupal\Console\Command\Node;
 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\Command\Command;
 use Drupal\Core\State\StateInterface;
-use Drupal\Console\Core\Command\Shared\CommandTrait;
-use Drupal\Console\Core\Style\DrupalStyle;
 
 /**
  * Class AccessRebuildCommand
@@ -22,8 +20,6 @@ use Drupal\Console\Core\Style\DrupalStyle;
  */
 class AccessRebuildCommand extends Command
 {
-    use CommandTrait;
-
     /**
      * @var StateInterface
      */
@@ -53,7 +49,7 @@ class AccessRebuildCommand extends Command
                 null,
                 InputOption::VALUE_NONE,
                 $this->trans('commands.node.access.rebuild.options.batch')
-            );
+            )->setAliases(['nar']);
     }
 
     /**
@@ -61,9 +57,8 @@ class AccessRebuildCommand extends Command
      */
     protected function execute(InputInterface $input, OutputInterface $output)
     {
-        $io = new DrupalStyle($input, $output);
-        $io->newLine();
-        $io->comment(
+        $this->getIo()->newLine();
+        $this->getIo()->comment(
             $this->trans('commands.node.access.rebuild.messages.rebuild')
         );
 
@@ -71,21 +66,21 @@ class AccessRebuildCommand extends Command
         try {
             node_access_rebuild($batch);
         } catch (\Exception $e) {
-            $io->error($e->getMessage());
+            $this->getIo()->error($e->getMessage());
 
             return 1;
         }
 
         $needs_rebuild = $this->state->get('node.node_access_needs_rebuild') ? : false;
         if ($needs_rebuild) {
-            $io->error(
+            $this->getIo()->error(
                 $this->trans('commands.node.access.rebuild.messages.failed')
             );
 
             return 1;
         }
 
-        $io->success(
+        $this->getIo()->success(
             $this->trans('commands.node.access.rebuild.messages.completed')
         );
         return 0;