Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to usage of DrupalFinderComposerRuntime API in ScriptHandler #677

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions scripts/composer/ScriptHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
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;

class ScriptHandler {

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

if (is_null($drupalRoot)) {
$event->getIO()->writeError('<error>Drupal root could not be detected.</error>');
exit(1);
}

$dirs = [
'modules',
'profiles',
Expand All @@ -43,7 +48,7 @@ public static function createRequiredFiles(Event $event) {
require_once $drupalRoot . '/core/includes/install.inc';
new Settings([]);
$settings['settings']['config_sync_directory'] = (object) [
'value' => '../config/sync',
'value' => Path::makeRelative($drupalFinder->getComposerRoot() . '/config/sync', $drupalRoot),
'required' => TRUE,
];
SettingsEditor::rewrite($drupalRoot . '/sites/default/settings.php', $settings);
Expand Down
Loading