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

fix namespace for Drush command sql-query with option "--db-prefix" in use (branch 8.x) #2882

Merged
merged 1 commit into from
Aug 21, 2017

Conversation

deminy
Copy link
Contributor

@deminy deminy commented Aug 17, 2017

I ran following command with Drush 8.x:

drush.sh sql-query --db-prefix "TRUNCATE TABLE {file_managed}"

and noticed following error message:

Error: Class 'Database' not found in .../vendor/drush/drush/lib/Drush/Sql/SqlBase.php on line 204 ...

The commit is to fix the issue in branch 8.x. I have another pull request to address the issue for branch master.

@weitzman weitzman merged commit 7759930 into drush-ops:8.x Aug 21, 2017
@jorrit
Copy link

jorrit commented Apr 18, 2018

Didn't this break Drupal 7?

@deminy
Copy link
Contributor Author

deminy commented Apr 18, 2018

It won't. Class \Drupal\Core\Database\Database is for Drupal 8 only, and it's called only when used by Drupal 8, as you can see from the code here.

@jorrit
Copy link

jorrit commented Apr 18, 2018

Well, I read >= 7 and that means it includes D7.

@deminy
Copy link
Contributor Author

deminy commented Apr 18, 2018

@jorrit You are right, I didn't read the code properly. Just had a new change addressing that and got it tested with Drupal 7. Not sure if a new pull request is needed or not.

@jorrit
Copy link

jorrit commented Apr 19, 2018

Thanks, that was something that I would have proposed also. How will it get into drush when you don't make a PR of it?

@deminy
Copy link
Contributor Author

deminy commented Apr 19, 2018

New pull request #3529 created to address the issue. Thanks for the comments and doing a code review on that.

weitzman pushed a commit that referenced this pull request May 28, 2018
* fix namespace for Drush command sql-query with option "--db-prefix" in use

* [#2882] make option "--db-prefix" work with all major versions of Drupal

* [#2882] store function call result to a variable to avoid multiple function calls
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

Successfully merging this pull request may close these issues.

3 participants