X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fdrupal%2Fconsole%2Fsrc%2FCommand%2FGenerate%2FUpdateCommand.php;fp=vendor%2Fdrupal%2Fconsole%2Fsrc%2FCommand%2FGenerate%2FUpdateCommand.php;h=15328006675a281a80dc60272db1e56c99586870;hp=923970a7e05b0807292f39360c5173ba6cfce153;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/vendor/drupal/console/src/Command/Generate/UpdateCommand.php b/vendor/drupal/console/src/Command/Generate/UpdateCommand.php index 923970a7e..153280066 100644 --- a/vendor/drupal/console/src/Command/Generate/UpdateCommand.php +++ b/vendor/drupal/console/src/Command/Generate/UpdateCommand.php @@ -13,12 +13,11 @@ use Symfony\Component\Console\Output\OutputInterface; use Drupal\Console\Generator\UpdateGenerator; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; -use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Extension\Manager; use Drupal\Console\Core\Utils\ChainQueue; use Drupal\Console\Utils\Site; +use Drupal\Console\Utils\Validator; /** * Class UpdateCommand @@ -29,16 +28,15 @@ class UpdateCommand extends Command { use ModuleTrait; use ConfirmationTrait; - use CommandTrait; /** - * @var Manager -*/ + * @var Manager + */ protected $extensionManager; /** - * @var UpdateGenerator -*/ + * @var UpdateGenerator + */ protected $generator; /** @@ -51,6 +49,10 @@ class UpdateCommand extends Command */ protected $chainQueue; + /** + * @var Validator + */ + protected $validator; /** * UpdateCommand constructor. @@ -64,12 +66,14 @@ class UpdateCommand extends Command Manager $extensionManager, UpdateGenerator $generator, Site $site, - ChainQueue $chainQueue + ChainQueue $chainQueue, + Validator $validator ) { $this->extensionManager = $extensionManager; $this->generator = $generator; $this->site = $site; $this->chainQueue = $chainQueue; + $this->validator = $validator; parent::__construct(); } @@ -90,7 +94,7 @@ class UpdateCommand extends Command null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.update.options.update-n') - ); + )->setAliases(['gu']); } /** @@ -98,10 +102,8 @@ class UpdateCommand extends Command */ protected function execute(InputInterface $input, OutputInterface $output) { - $io = new DrupalStyle($input, $output); - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io)) { + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmOperation + if (!$this->confirmOperation()) { return 1; } @@ -119,7 +121,10 @@ class UpdateCommand extends Command ); } - $this->generator->generate($module, $updateNumber); + $this->generator->generate([ + 'module' => $module, + 'update_number' => $updateNumber, + ]); $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); @@ -128,24 +133,18 @@ class UpdateCommand extends Command protected function interact(InputInterface $input, OutputInterface $output) { - $io = new DrupalStyle($input, $output); - $this->site->loadLegacyFile('/core/includes/update.inc'); $this->site->loadLegacyFile('/core/includes/schema.inc'); - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } + // --module option + $module = $this->getModuleOption(); $lastUpdateSchema = $this->getLastUpdate($module); $nextUpdateSchema = $lastUpdateSchema ? ($lastUpdateSchema + 1): 8001; $updateNumber = $input->getOption('update-n'); if (!$updateNumber) { - $updateNumber = $io->ask( + $updateNumber = $this->getIo()->ask( $this->trans('commands.generate.update.questions.update-n'), $nextUpdateSchema, function ($updateNumber) use ($lastUpdateSchema) { @@ -174,12 +173,6 @@ class UpdateCommand extends Command } } - - protected function createGenerator() - { - return new UpdateGenerator(); - } - protected function getLastUpdate($module) { $this->site->loadLegacyFile('/core/includes/update.inc');