X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fdrupal%2Fconsole%2Fsrc%2FCommand%2FConfig%2FDeleteCommand.php;fp=vendor%2Fdrupal%2Fconsole%2Fsrc%2FCommand%2FConfig%2FDeleteCommand.php;h=7c1922b1c855faa174ab92cdba0fc70e304123ea;hp=7ab29c664685f9791123881a5f467b9fd6a82e9c;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/vendor/drupal/console/src/Command/Config/DeleteCommand.php b/vendor/drupal/console/src/Command/Config/DeleteCommand.php index 7ab29c664..7c1922b1c 100644 --- a/vendor/drupal/console/src/Command/Config/DeleteCommand.php +++ b/vendor/drupal/console/src/Command/Config/DeleteCommand.php @@ -10,17 +10,13 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Yaml\Exception\RuntimeException; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Config\StorageInterface; use Drupal\Core\Config\CachedStorage; use Drupal\Core\Config\ConfigFactory; -use Drupal\Console\Core\Command\Shared\CommandTrait; -use Drupal\Console\Core\Style\DrupalStyle; class DeleteCommand extends Command { - use CommandTrait; - protected $allConfig = []; /** @@ -73,7 +69,7 @@ class DeleteCommand extends Command 'name', InputArgument::OPTIONAL, $this->trans('commands.config.delete.arguments.name') - ); + )->setAliases(['cd']); } /** @@ -81,11 +77,9 @@ class DeleteCommand extends Command */ protected function interact(InputInterface $input, OutputInterface $output) { - $io = new DrupalStyle($input, $output); - $type = $input->getArgument('type'); if (!$type) { - $type = $io->choiceNoList( + $type = $this->getIo()->choiceNoList( $this->trans('commands.config.delete.arguments.type'), ['active', 'staging'], 'active' @@ -95,7 +89,7 @@ class DeleteCommand extends Command $name = $input->getArgument('name'); if (!$name) { - $name = $io->choiceNoList( + $name = $this->getIo()->choiceNoList( $this->trans('commands.config.delete.arguments.name'), $this->getAllConfigNames(), 'all' @@ -109,30 +103,28 @@ class DeleteCommand extends Command */ protected function execute(InputInterface $input, OutputInterface $output) { - $io = new DrupalStyle($input, $output); - $type = $input->getArgument('type'); if (!$type) { - $io->error($this->trans('commands.config.delete.errors.type')); + $this->getIo()->error($this->trans('commands.config.delete.errors.type')); return 1; } $name = $input->getArgument('name'); if (!$name) { - $io->error($this->trans('commands.config.delete.errors.name')); + $this->getIo()->error($this->trans('commands.config.delete.errors.name')); return 1; } $configStorage = ('active' === $type) ? $this->configStorage : $this->configStorageSync; if (!$configStorage) { - $io->error($this->trans('commands.config.delete.errors.config-storage')); + $this->getIo()->error($this->trans('commands.config.delete.errors.config-storage')); return 1; } if ('all' === $name) { - $io->commentBlock($this->trans('commands.config.delete.warnings.undo')); - if ($io->confirm($this->trans('commands.config.delete.questions.sure'))) { + $this->getIo()->commentBlock($this->trans('commands.config.delete.warnings.undo')); + if ($this->getIo()->confirm($this->trans('commands.config.delete.questions.sure'))) { if ($configStorage instanceof FileStorage) { $configStorage->deleteAll(); } else { @@ -141,7 +133,7 @@ class DeleteCommand extends Command } } - $io->success($this->trans('commands.config.delete.messages.all')); + $this->getIo()->success($this->trans('commands.config.delete.messages.all')); return 0; } @@ -154,7 +146,7 @@ class DeleteCommand extends Command $this->removeConfig($name); } - $io->success( + $this->getIo()->success( sprintf( $this->trans('commands.config.delete.messages.deleted'), $name @@ -164,7 +156,7 @@ class DeleteCommand extends Command } $message = sprintf($this->trans('commands.config.delete.errors.not-exists'), $name); - $io->error($message); + $this->getIo()->error($message); return 1; }