From 00f2bd6e4d68da57a23c8ff875462903ef6c6d16 Mon Sep 17 00:00:00 2001 From: "tan.nguyen" Date: Thu, 6 Jun 2024 10:45:36 +0700 Subject: [PATCH 1/2] Use new Drupal finder api. --- composer.json | 2 +- scripts/composer/ScriptHandler.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 16a2331f9..844473831 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "drush/drush": "^12.4.3", "oomphinc/composer-installers-extender": "^2.0", "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 088c2b608..d1479cfda 100644 --- a/scripts/composer/ScriptHandler.php +++ b/scripts/composer/ScriptHandler.php @@ -12,6 +12,7 @@ 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,8 +20,7 @@ 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 +44,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); From 854e33927a1ae81dc14aa9118bd2e5eedfafacb5 Mon Sep 17 00:00:00 2001 From: "tan.nguyen" Date: Thu, 6 Jun 2024 11:00:17 +0700 Subject: [PATCH 2/2] Remove unuse namespace. --- scripts/composer/ScriptHandler.php | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/composer/ScriptHandler.php b/scripts/composer/ScriptHandler.php index d1479cfda..837f0c740 100644 --- a/scripts/composer/ScriptHandler.php +++ b/scripts/composer/ScriptHandler.php @@ -14,7 +14,6 @@ use DrupalFinder\DrupalFinder; use DrupalFinder\DrupalFinderComposerRuntime; use Symfony\Component\Filesystem\Filesystem; -use Symfony\Component\Filesystem\Path; class ScriptHandler {