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

CiviCRM drush commands looking in wrong place for sql class #3607

Closed
freeform-sg opened this issue Jul 5, 2018 · 1 comment
Closed

CiviCRM drush commands looking in wrong place for sql class #3607

freeform-sg opened this issue Jul 5, 2018 · 1 comment

Comments

@freeform-sg
Copy link

We are running CiviCRM 4.6.33, Drupal 7.59, and Drush 8.1.17. Drupal & CIviCRM are running without issue, and all native Drush commands appear to be working as expected, including sql-dump. Where we are running into trouble is running an CiviCRM drush command the requires an sql connection, such as civicrm-sql-dump.

exception 'Drush\Sql\SqlException' with message 'Unable to find a matching SQL Class. Drush cannot find your database connection          [error]
details.' in phar:///usr/local/bin/drush/commands/sql/sql.drush.inc:545
Stack trace:
#0 phar:///usr/local/bin/drush/commands/sql/sql.drush.inc(446): drush_sql_get_class()
#1 /var/www/vhosts/domain.org/httpdocs/sites/all/modules/civicrm/drupal/drush/civicrm.drush.inc(1365): drush_sql_cli()
#2 [internal function]: drush_civicrm_sqlcli()
#3 phar:///usr/local/bin/drush/includes/command.inc(422): call_user_func_array('drush_civicrm_s...', Array)
#4 phar:///usr/local/bin/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
#5 [internal function]: drush_command()
#6 phar:///usr/local/bin/drush/includes/command.inc(199): call_user_func_array('drush_command', Array)
#7 phar:///usr/local/bin/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#8 phar:///usr/local/bin/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#9 phar:///usr/local/bin/drush/includes/startup.inc(465): drush_main()
#10 phar:///usr/local/bin/drush/includes/startup.inc(369): drush_run_main(false, '/', 'Phar detected. ...')
#11 phar:///usr/local/bin/drush/drush(114): drush_startup(Array)
#12 /usr/local/bin/drush(10): require('phar:///usr/loc...')
#13 {main}

"/usr/local/bin/drush/commands/sql/sql.drush.inc" is not the correct location of this file and not sure how to fix this.

Have seen a similar post here: #2721 however the solution provided did not work for us. Tried setting host to "localhost" & "127.0.0.1" in settings file, and tried adding "--root=/path/to/webroot".

We were successfully using these commands in the past without issue, and continue to have no issue with the regular Drupal drush commands. Issue appears to have begun after updating to Drush 8.1.17, not sure what to try next.

Thanks!

@greg-1-anderson
Copy link
Member

Unable to find a matching SQL Class is a bad error message. What Drush is trying to tell you here is that it could not find the sites $database details. It fails to error out here, though, and instead tries to find a driver for "" instead of "mysql".

Not sure why you'd be having trouble with getting $databases for your commands but not Drush core commands. In fact, you should already have $databases loaded if Drush is finding your commands at all. It could be that you are seeing a the symptom above for a similar but different problem.

If the problem is in fact caused by Drush, you could try checking out Drush via git, and use git bisect to find the commit that broke your environment.

@weitzman weitzman closed this as completed Oct 8, 2018
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

3 participants