X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fdrupal%2Fconsole%2Fsrc%2FCommand%2FNode%2FAccessRebuildCommand.php;fp=vendor%2Fdrupal%2Fconsole%2Fsrc%2FCommand%2FNode%2FAccessRebuildCommand.php;h=b950e2d6573a0c92d1e1939507499d9e0a493a2d;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/vendor/drupal/console/src/Command/Node/AccessRebuildCommand.php b/vendor/drupal/console/src/Command/Node/AccessRebuildCommand.php new file mode 100644 index 000000000..b950e2d65 --- /dev/null +++ b/vendor/drupal/console/src/Command/Node/AccessRebuildCommand.php @@ -0,0 +1,93 @@ +state = $state; + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('node:access:rebuild') + ->setDescription($this->trans('commands.node.access.rebuild.description')) + ->addOption( + 'batch', + null, + InputOption::VALUE_NONE, + $this->trans('commands.node.access.rebuild.options.batch') + ); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + $io->newLine(); + $io->comment( + $this->trans('commands.node.access.rebuild.messages.rebuild') + ); + + $batch = $input->getOption('batch'); + try { + node_access_rebuild($batch); + } catch (\Exception $e) { + $io->error($e->getMessage()); + + return 1; + } + + $needs_rebuild = $this->state->get('node.node_access_needs_rebuild') ? : false; + if ($needs_rebuild) { + $io->error( + $this->trans('commands.node.access.rebuild.messages.failed') + ); + + return 1; + } + + $io->success( + $this->trans('commands.node.access.rebuild.messages.completed') + ); + return 0; + } +}