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

[site:install] Distinguish between an empty db prefix and no db prefix #3930

Closed
jensschulze opened this issue Sep 16, 2018 · 1 comment
Closed
Milestone

Comments

@jensschulze
Copy link
Contributor

Distinguish between an empty db prefix and no db prefix

[site:install] Atm you have to use --no-interaction if you want to pass an empty db prefix. If you type --db-prefix="" the result is the same as if you had just simply omitted this option.

Problem/Motivation

If the value of an option is explicitly set it should not be asked for later. You can suppress this inconsistent behaviour with --no-interaction but one should not need
I am running into this issue whenever I'm trying to set up a "throw away" installation.

How to reproduce

Last checked on Drupal 8.6.1 with drupal/console 1.8.0

composer create-project drupal-composer/drupal-project:8.x-dev somedirectory --stability dev --no-interaction

cd somedirectory

vendor/bin/drupal si standard \
    --langcode="en" \
    --db-type="sqlite" \
    --db-file="sites/default/files/drupaldb.sqlite " \
    --db-prefix="" \
    --account-name=admin \
    --account-pass=admin \
    [email protected] \
    --site-name="This is just a test" \
    --site-mail="[email protected]"

Even though the --db-prefix is set, the command will ask for the prefix (the default value is an empty string).

Solution

If no --db-prefix is given, the option's default value is null. So in Site\InstallCommand::interact() we can easily distinguish between "no --db-prefix given" (ask) and "empty --db-prefix given" (no action).

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