File tree 1 file changed +11
-2
lines changed
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 11
11
use Composer \Semver \Comparator ;
12
12
use Drupal \Core \Site \Settings ;
13
13
use Drupal \Core \Site \SettingsEditor ;
14
- use DrupalFinder \DrupalFinder ;
15
14
use DrupalFinder \DrupalFinderComposerRuntime ;
16
15
use Symfony \Component \Filesystem \Filesystem ;
16
+ use Symfony \Component \Filesystem \Path ;
17
17
18
18
class ScriptHandler {
19
19
@@ -22,6 +22,15 @@ public static function createRequiredFiles(Event $event) {
22
22
$ drupalFinder = new DrupalFinderComposerRuntime ();
23
23
$ drupalRoot = $ drupalFinder ->getDrupalRoot ();
24
24
25
+ // If Drupal root was not found, exit.
26
+ if (is_null ($ drupalRoot )) {
27
+ $ io = $ event ->getIO ();
28
+ $ io ->writeError (
29
+ '<error>Drupal root could not be detected.</error> ' ,
30
+ );
31
+ exit (1 );
32
+ }
33
+
25
34
$ dirs = [
26
35
'modules ' ,
27
36
'profiles ' ,
@@ -43,7 +52,7 @@ public static function createRequiredFiles(Event $event) {
43
52
require_once $ drupalRoot . '/core/includes/install.inc ' ;
44
53
new Settings ([]);
45
54
$ settings ['settings ' ]['config_sync_directory ' ] = (object ) [
46
- 'value ' => ' .. /config/sync ' ,
55
+ 'value ' => Path:: makeRelative ( $ drupalFinder -> getComposerRoot () . ' /config/sync ', $ drupalRoot ) ,
47
56
'required ' => TRUE ,
48
57
];
49
58
SettingsEditor::rewrite ($ drupalRoot . '/sites/default/settings.php ' , $ settings );
You can’t perform that action at this time.
0 commit comments