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

Give site-install an interactive mode. #2484

Closed
serundeputy opened this issue Dec 3, 2016 · 4 comments
Closed

Give site-install an interactive mode. #2484

serundeputy opened this issue Dec 3, 2016 · 4 comments

Comments

@serundeputy
Copy link
Contributor

If no --db-url option is specified drop into interactive shell prompts to get the required information form the user.

@serundeputy
Copy link
Contributor Author

serundeputy commented Dec 3, 2016

@greg-1-anderson I wonder if you'd be willing to take a look at this PR: #2485

In the file: site_install.drush.inc I've introduced the drush_prompt's if --db-url is empty.

$db_spec['database'] = drush_prompt('Database name');
$db_spec['driver'] = drush_prompt('Database driver', 'mysql');
$db_spec['username'] = drush_prompt('Database username');
$db_spec['password'] = drush_prompt('Database password');
$db_spec['host'] = drush_prompt('Database host', 'localhost');
$db_spec['port'] = drush_prompt('Database port', '3306');
//$db_spec->db_prefix = drush_prompt('Database prefix', NULL);
//return drush_sql_get_class($db_spec);
$sql = drush_sql_get_class($db_spec);

That seems to get the $db_spec and either create the DB or drop the tables as necessary, but then I seem to have to repopulate the $db_spec in either commands/core/drupal/site_install.inc for D8 or commands/core/drupal/site_install_7.inc for D7.

There must be a way I can pass the $db_spec info through to those functions, but I can't figure it out ... you think you could give me some direction?

@weitzman
Copy link
Member

weitzman commented Jan 2, 2017

In 8.x, you could try with drush_set_option('db-url, drush_sitealias_convert_db_spec_to_db_url($db_spec));

Note that we'll need PR for master branch first, and then can merge this into 8.x. Thanks for the great improvement.

serundeputy added a commit to serundeputy/drush that referenced this issue Jan 3, 2017
@serundeputy
Copy link
Contributor Author

@weitzman thanks!

re-rolled against master

#2485

serundeputy added a commit to serundeputy/drush that referenced this issue Feb 9, 2017
serundeputy added a commit to serundeputy/drush that referenced this issue Feb 12, 2017
Issue drush-ops#2484: Give site-install and interactive mode.

Issue drush-ops#2484: Give site-install and interactive mode.
@weitzman
Copy link
Member

weitzman commented Jun 1, 2017

This went in

@weitzman weitzman closed this as completed Jun 1, 2017
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