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

Add support for drush sqlsan / drush sql-sanitize #46

Open
jenlampton opened this issue Jul 23, 2016 · 8 comments
Open

Add support for drush sqlsan / drush sql-sanitize #46

jenlampton opened this issue Jul 23, 2016 · 8 comments

Comments

@jenlampton
Copy link
Member

jenlampton commented Jul 23, 2016

...to generate a sanitized database :)

I currently get:

Drush command terminated abnormally due to an unrecoverable error.                                          
Error: Class 'Drupal' not found in drush-8/commands/sql/sql.drush.inc, line 648

PR from @quicksketch at #47
PR from @jenlampton at #63

@quicksketch
Copy link
Member

We probably won't be able to convince the Drush team to add Backdrop-specific code to their SQL integration, but we can write our own sanitation callback and alter-out the original one. I filed a PR at #47.

@serundeputy
Copy link
Member

Thanks @quicksketch this is merged into master; @jenlampton enjoy new simplified sql-santize workflow! :)

@serundeputy
Copy link
Member

serundeputy commented Jul 26, 2016

@quicksketch Looks like this actually broke sql-sanitize at least for D7 for me.

$ drush sql-sanitize
include_once(DRUSH_BACKDROP_CORE/includes/password.inc): failed to open stream: No such file or directory backdrop.drush.inc:172                          [warning]
include_once(): Failed opening 'DRUSH_BACKDROP_CORE/includes/password.inc' for inclusion (include_path='.:') backdrop.drush.inc:172                       [warning]
include_once(DRUSH_BACKDROP_CORE/includes/bootstrap.inc): failed to open stream: No such file or directory backdrop.drush.inc:173                         [warning]
include_once(): Failed opening 'DRUSH_BACKDROP_CORE/includes/bootstrap.inc' for inclusion (include_path='.:') backdrop.drush.inc:173                      [warning]
PHP Fatal error:  Call to undefined function user_hash_password() in /Users/geoff/.drush/extenstions/backdrop/backdrop.drush.inc on line 174

Fatal error: Call to undefined function user_hash_password() in /Users/geoff/.drush/extenstions/backdrop/backdrop.drush.inc on line 174
Drush command terminated abnormally due to an unrecoverable error.                                                                                        [error]
Error: Call to undefined function user_hash_password() in /Users/geoff/.drush/extenstions/backdrop/backdrop.drush.inc, line 174

:(

I've reverted this commit so that we don't break peoples Drupal 7 functionality while we work to a solt'n on this.

~Geoff

@serundeputy serundeputy reopened this Jul 26, 2016
@quicksketch
Copy link
Member

Ah, well maybe we can add a check in there for the current bootstrap class, just like we do for hook_drush_command_alter():

  $bootstrap = drush_get_bootstrap_object();
  if (!is_a($bootstrap, 'Drush\Boot\BackdropBoot')) {
    return;
  }

@jenlampton
Copy link
Member Author

Just pushed a new PR at #63 that adds the recommended fix above.

@serundeputy
Copy link
Member

@jenlampton with this PR it works on Backdrop, but on D7 if I issue the command it executes, does not report any feedback, but the PWs and emails are not sanitized.

geoff@gspmbp vanilla $ drush sql-sanitize
Do you really want to sanitize the current database? (y/n): y
geoff@gspmbp vanilla $ drush cc all
'all' cache was cleared.                                                                                                                                               [success]
geoff@gspmbp vanilla $ drush sql-sanitize -vvv
Undefined index: description command.inc:1245                                                                                                                             [notice]
Undefined index: description command.inc:1245                                                                                                                             [notice]
Undefined index: description command.inc:1245                                                                                                                             [notice]
Do you really want to sanitize the current database? (y/n): y
Undefined variable: sanitize_query sql.drush.inc:487                                                                                                                      [notice]
Command dispatch complete

so, it silently fails on D7, but still breaks the sql-sanitize command for D7 users :(

@serundeputy
Copy link
Member

from @jenlampton in the PR

bah. That's the same thing I was seeing with #64. Sounds like perhaps a larger problem?

I think it is a larger problem ... I believe it to be connected to the namespacing issues we were having with #14 (comment)

@jenlampton
Copy link
Member Author

For others who need to use this: I have a local branch with this patch applied. My scripts switch to the sqlsan branch before running the sqlsan command and then switch back.

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