From 4d5bb57e1307b7de987b6b63b3a476355cb526a6 Mon Sep 17 00:00:00 2001 From: Tan Nguyen Date: Sat, 8 Jun 2024 04:20:18 +0700 Subject: [PATCH] Use new Drupal Finder API. (#673) --- composer.json | 2 +- scripts/composer/ScriptHandler.php | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 074e0b476..4b3025108 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,7 @@ "oomphinc/composer-installers-extender": "^2.0", "ramsalt/drupal-scaffold": "*", "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 244178817..3d3ba626f 100644 --- a/scripts/composer/ScriptHandler.php +++ b/scripts/composer/ScriptHandler.php @@ -12,15 +12,14 @@ 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; class ScriptHandler { public static function createRequiredFiles(Event $event) { $fs = new Filesystem(); - $drupalFinder = new DrupalFinder(); - $drupalFinder->locateRoot(getcwd()); + $drupalFinder = new DrupalFinderComposerRuntime(); $drupalRoot = $drupalFinder->getDrupalRoot(); $dirs = [ @@ -44,7 +43,7 @@ public static function createRequiredFiles(Event $event) { require_once $drupalRoot . '/core/includes/install.inc'; new Settings([]); $settings['settings']['config_sync_directory'] = (object) [ - 'value' => Path::makeRelative($drupalFinder->getComposerRoot() . '/config/sync', $drupalRoot), + 'value' => '../config/sync', 'required' => TRUE, ]; SettingsEditor::rewrite($drupalRoot . '/sites/default/settings.php', $settings);