From 8ab068e45ebe05024bd6e2021f86d23d24926622 Mon Sep 17 00:00:00 2001 From: Vishal Khode Date: Tue, 19 Mar 2024 11:52:04 +0530 Subject: [PATCH] ACMS-3658: Minor code refactored. --- src/Plugin.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Plugin.php b/src/Plugin.php index 398cc23..a43333b 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -2,6 +2,7 @@ namespace Acquia\Drupal\RecommendedSettings; +use Acquia\Drupal\RecommendedSettings\Drush\Commands\SettingsDrushCommands; use Acquia\Drupal\RecommendedSettings\Exceptions\SettingsException; use Composer\Composer; use Composer\DependencyResolver\Operation\InstallOperation; @@ -94,8 +95,6 @@ public function onPostPackageEvent(PackageEvent $event): void { /** * Includes Acquia recommended settings post composer update/install command. - * - * @throws \Acquia\Drupal\RecommendedSettings\Exceptions\SettingsException */ public function onPostCmdEvent(): void { // Only install the template files, if the drupal-recommended-settings @@ -103,7 +102,10 @@ public function onPostCmdEvent(): void { if ($this->settingsPackage && $this->getDrupalRoot()) { try { $vendor_dir = $this->composer->getConfig()->get('vendor-dir'); - $this->executeCommand($vendor_dir . "/bin/drush drs:init:settings", [], TRUE); + $this->executeCommand( + $vendor_dir . "/bin/drush " . SettingsDrushCommands::SETTINGS_COMMAND, [], + TRUE + ); } catch (SettingsException $e) { $this->io->write("[error] " . $e->getMessage()); @@ -178,11 +180,10 @@ protected function executeCommand(string $cmd, array $args = [], bool $display_o array_unshift($args, $cmd); // And replace the arguments. $command = call_user_func_array('sprintf', $args); - $output = ''; if ($this->io->isVerbose() || $display_output) { $this->io->write(' > ' . $command . ''); $io = $this->io; - $output = function ($type, $buffer) use ($io): void { + function ($type, $buffer) use ($io): void { $io->write($buffer, FALSE); }; }