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

Comments

Projects
None yet
2 participants
@jensschulze
Copy link
Contributor

commented Sep 16, 2018

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 \
    --account-mail=admin@example.com \
    --site-name="This is just a test" \
    --site-mail="admin@example.com"

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).

@LOBsTerr

This comment has been minimized.

Copy link
Member

commented Sep 19, 2018

@jensschulze Thanks I have merged it

@LOBsTerr LOBsTerr closed this Sep 19, 2018

@LOBsTerr LOBsTerr added this to the 1.9.0 milestone Sep 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.