Skip to content

Commit

Permalink
ACMS-3658: Minor code refactored.
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalkhode1 committed Mar 19, 2024
1 parent 58ae947 commit 1c71ee1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,17 @@ 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
// plugin is installed, with drupal project.
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 drs:init:settings", [],
TRUE
);
}
catch (SettingsException $e) {
$this->io->write("<fg=white;bg=red;options=bold>[error]</> " . $e->getMessage());
Expand Down Expand Up @@ -178,11 +179,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('<comment> > ' . $command . '</comment>');
$io = $this->io;
$output = function ($type, $buffer) use ($io): void {
function ($type, $buffer) use ($io): void {
$io->write($buffer, FALSE);
};
}
Expand Down

0 comments on commit 1c71ee1

Please sign in to comment.