Closed (fixed)
Project:
Drush
Version:
All-versions-4.x-dev
Component:
SQL
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
22 Jul 2011 at 03:07 UTC
Updated:
26 Feb 2012 at 02:40 UTC
Most of the SQL commands require a minimum bootstrap level of DRUSH_BOOTSTRAP_DATABASE because they need to operate on a database (of course). Since one can supply a database via --db-url option, I think we should reduce the DRUSH_BOOTSTRAP_DRUSH. Any objection? I refer to sql-query, sql-drop, and others.
Comments
Comment #1
greg.1.anderson commentedYes, I agree in concept, but I think that in principal the current code might need to be DRUSH_BOOTSTRAP_DRUPAL, because we do not know what the $db_url is until then. It would be possible to recode the bootstrap process so that we decide what site we are going to target in DRUSH_BOOTSTRAP_DRUSH, but hold off on actually bootstrapping Drupal until the next phase. This would improve some other code in the bootstrap process, but it would not help us get $db_url, because we currently get that by including settings.php, which pollutes our global environment. I don't suppose there's any way to include a php file in another context? I suppose we could 'exec'
<?php include 'settings.php'; print $db_url;if we really wanted to.In conclusion, I think we could pull the requirement back to DRUSH_BOOTSTRAP_DRUPAL without changing the bootstrap code. Didn't try it, though.
Comment #2
moshe weitzman commentedRight. I think I'll reduce the 'bootstrap' level and in a validate hook:
Comment #3
greg.1.anderson commentedI think maybe DRUSH_BOOTSTRAP_CONFIGURATION is enough to get $db_url, but yes, the above is good.
Comment #4
moshe weitzman commentedCommitted. Lets backport for 4.6
Comment #5
glennpratt commentedI believe this is the commit to be backported.
http://drupalcode.org/project/drush.git/commitdiff/0bbca5c19dbf1762fc996...
Comment #6
moshe weitzman commentedI'm pretty undecided about the benefit/risk for backporting that commit. Anyone have an opinion?
Comment #7
greg.1.anderson commentedAs far as risk is concerned, I think this is safe to backport. As for benefit vs. effort, I find this patch useful in Drush 5, but I don't personally think it is too important to backport. Certainly could be done if anyone felt like it, though.
Comment #8
msonnabaum commentedBackported this, which needed a few more to get tests passing again.