diff --git a/composer.json b/composer.json index 5859756f6..04416a73c 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ "drupal/core-recommended": "^10.2.0", "drush/drush": "^12.4.3", "vlucas/phpdotenv": "^5.1", - "webflo/drupal-finder": "^1.2" + "webflo/drupal-finder": "^1.3" }, "require-dev": { "drupal/core-dev": "^10.2.0", diff --git a/scripts/composer/ScriptHandler.php b/scripts/composer/ScriptHandler.php index 27efd7c69..706fabc79 100644 --- a/scripts/composer/ScriptHandler.php +++ b/scripts/composer/ScriptHandler.php @@ -11,7 +11,7 @@ use Composer\Semver\Comparator; use Drupal\Core\Site\Settings; use Drupal\Core\Site\SettingsEditor; -use DrupalFinder\DrupalFinder; +use DrupalFinder\DrupalFinderComposerRuntime; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Filesystem\Path; @@ -19,10 +19,18 @@ class ScriptHandler { public static function createRequiredFiles(Event $event) { $fs = new Filesystem(); - $drupalFinder = new DrupalFinder(); - $drupalFinder->locateRoot(getcwd()); + $drupalFinder = new DrupalFinderComposerRuntime(); $drupalRoot = $drupalFinder->getDrupalRoot(); + // If Drupal root was not found, exit. + if (is_null($drupalRoot)) { + $io = $event->getIO(); + $io->writeError( + 'Drupal root could not be detected.', + ); + exit(1); + } + $dirs = [ 'modules', 'profiles',