Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalkhode1 committed Mar 27, 2024
2 parents d5d2217 + 8a2d946 commit 3b57349
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Composer\Composer;
use Composer\DependencyResolver\Operation\InstallOperation;
use Composer\DependencyResolver\Operation\OperationInterface;
use Composer\DependencyResolver\Operation\UpdateOperation;
use Composer\EventDispatcher\EventSubscriberInterface;
use Composer\Installer\PackageEvent;
use Composer\Installer\PackageEvents;
Expand Down Expand Up @@ -41,6 +42,11 @@ class Plugin implements PluginInterface, EventSubscriberInterface {
*/
protected mixed $settingsPackage = NULL;

/**
* Checks if acquia/blt is updated.
*/
protected bool $bltUpdated = FALSE;

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -96,7 +102,7 @@ public function onPostPackageEvent(PackageEvent $event): void {
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()) {
if ($this->settingsPackage && $this->getDrupalRoot() && !$this->bltUpdated) {
$vendor_dir = $this->composer->getConfig()->get('vendor-dir');
$this->executeCommand(
$vendor_dir . "/bin/drush drs:init:settings", [],
Expand All @@ -118,6 +124,9 @@ protected function getSettingsPackage(OperationInterface $operation): mixed {
if ($operation instanceof InstallOperation) {
$package = $operation->getPackage();
}
elseif ($operation instanceof UpdateOperation && $operation->getTargetPackage() instanceof PackageInterface) {
$this->bltUpdated = ($operation->getTargetPackage()->getName() == "acquia/blt");
}
if (isset($package) && $package instanceof PackageInterface && $package->getName() == "acquia/drupal-recommended-settings") {
return $package;
}
Expand Down

0 comments on commit 3b57349

Please sign in to comment.