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

Fail gracefully when $this->appDir./sites not found #19

Open
JParkinson1991 opened this issue Jun 29, 2020 · 3 comments
Open

Fail gracefully when $this->appDir./sites not found #19

JParkinson1991 opened this issue Jun 29, 2020 · 3 comments

Comments

@JParkinson1991
Copy link

JParkinson1991 commented Jun 29, 2020

During installation of this package, during early site builds where the 'sites' directory does not exist under $this->appDir/sites an InvalidArgumentException or a DirectoryNotFoundException will be thrown by the Symfony Finder package.

This can cause failed installations and also causes the drupal:paranoia command to fail.

These exceptions should be caught by the Installer and handled gracefully.

It is safe to assumes public files directories do not exist under $this->appDir if the sites directory is not found.

Expected behavior

Failing gracefully without attempting to link the non existent directories.

Actual behavior

Uncaught exception breaking package installation, plugin events and the provided commands.

Steps to reproduce

During install

  1. Create a project without a 'sites' directory inside the configured app-dir
  2. Require drupal-composer/drupal-paranoia
  3. See the uncaught exception in console output

When running as a command

  1. Create a project without a 'sites' directory inside the configured app-dir
  2. Require drupal-composer/drupal-paranoia
  3. Run composer drupal:paranoia
  4. See the uncaught exception in console output

Possible solution

#20

@JParkinson1991 JParkinson1991 changed the title Fail gracefully when $this->appDir. / sites not found Fail gracefully when $this->appDir./sites not found Jun 29, 2020
@JParkinson1991
Copy link
Author

Pull request created #20

Catches core Exception due to different exceptions that can be thrown by the Symfony Finder component.

@jkribeiro
Copy link
Collaborator

jkribeiro commented Jun 29, 2020

@JParkinson1991 Do you have a case where the folder $this->appDir/sites would not exist when running the command or composer install/update?

Just asking because I never saw this case.

@JParkinson1991
Copy link
Author

JParkinson1991 commented Jun 29, 2020

@jkribeiro I tend to usually framework my Drupal stacks manually, so i dont use the drupal-project template.

When im building my project i like to test that all scaffolding and paranoia etc is working before i start adding in sites, so in early stages of project builds i dont have a sites folder whilst im testing this plugin along with the drupal/core-composer-scaffold plugin.

Running this plugin without a sites directory is an edge case that probably wont affect many users for sure. But i do think it should be handled and not cause this plugin to break.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants