Skip to content

Commit e7d5c58

Browse files
Changes to usage of DrupalFinderComposerRuntime API in ScriptHandler (#677)
Co-authored-by: Alex Skrypnyk <[email protected]>
1 parent 265c3b1 commit e7d5c58

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

scripts/composer/ScriptHandler.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
use Composer\Semver\Comparator;
1212
use Drupal\Core\Site\Settings;
1313
use Drupal\Core\Site\SettingsEditor;
14-
use DrupalFinder\DrupalFinder;
1514
use DrupalFinder\DrupalFinderComposerRuntime;
1615
use Symfony\Component\Filesystem\Filesystem;
16+
use Symfony\Component\Filesystem\Path;
1717

1818
class ScriptHandler {
1919

@@ -22,6 +22,11 @@ public static function createRequiredFiles(Event $event) {
2222
$drupalFinder = new DrupalFinderComposerRuntime();
2323
$drupalRoot = $drupalFinder->getDrupalRoot();
2424

25+
if (is_null($drupalRoot)) {
26+
$event->getIO()->writeError('<error>Drupal root could not be detected.</error>');
27+
exit(1);
28+
}
29+
2530
$dirs = [
2631
'modules',
2732
'profiles',
@@ -43,7 +48,7 @@ public static function createRequiredFiles(Event $event) {
4348
require_once $drupalRoot . '/core/includes/install.inc';
4449
new Settings([]);
4550
$settings['settings']['config_sync_directory'] = (object) [
46-
'value' => '../config/sync',
51+
'value' => Path::makeRelative($drupalFinder->getComposerRoot() . '/config/sync', $drupalRoot),
4752
'required' => TRUE,
4853
];
4954
SettingsEditor::rewrite($drupalRoot . '/sites/default/settings.php', $settings);

0 commit comments

Comments
 (0)