From 9f4f6a537d091213c571194e4ad3f3b0e10835ce 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 | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Plugin.php b/src/Plugin.php index 398cc23..88a451d 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,13 +180,12 @@ 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); - }; + } } return ($this->executor->executeTty($command) == 0); }