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

Use new Drupal Finder API. #673

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions scripts/composer/ScriptHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
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 = [
Expand All @@ -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',
Copy link
Contributor Author

@tannguyen04 tannguyen04 Jun 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With new Drupal Finder version 1.3, $drupalFinder->getComposerRoot() return empty string not same the old one.
More info webflo/drupal-finder#72

I think we can safety hard code relative path ../config/sync at here. Drupal can handle relative path to Drupal root itself

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tannguyen04 – I was curious if this still works when you put a nested folder for extra.drupal-scaffold.locations.web-root (e.g. web/test/) but this is not how extra.drupal-scaffold.locations.web-root is supposed to work. You can not have nested directories at this point. So ../config/sync should be fine.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also fixed the tests not passing in #650. 👌🏻

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sound like waiting for a response on webflo/drupal-finder#72 or diving into that further might be the best approach here?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"safety hard code relative path ../config/sync" is breaking our install and update process because composer root, drupal root and config root are at the same level.

I will manually override the dir in our project and will wait until the webflo-issue is fixed.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhh, of course you can have . as web root and then it breaks. 💡

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sascha-krug - would you be so kind and create a follow-up issue for it, please? I don't know when I've time at the computer again.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course. Done: #675

'required' => TRUE,
];
SettingsEditor::rewrite($drupalRoot . '/sites/default/settings.php', $settings);
Expand Down
Loading