diff --git a/commands/sql/sync.sql.inc b/commands/sql/sync.sql.inc index 2b718a3..9bf768f 100644 --- a/commands/sql/sync.sql.inc +++ b/commands/sql/sync.sql.inc @@ -125,8 +125,18 @@ function sql_drush_sql_sync_sanitize($site) { } if (!empty($user_table_updates)) { + if ($newemail != 'no') { + drush_sql_register_post_sync_op('pre-user-init', dt('Pre process init in user table'), "UPDATE users SET init = 'sql-sync' WHERE init LIKE '%@%' AND init NOT LIKE '%:%';"); + } + $sanitize_query = "UPDATE users SET " . implode(', ', $user_table_updates) . " WHERE uid > 0;"; drush_sql_register_post_sync_op('user-email', dt('Reset !message in user table', array('!message' => implode(' and ', $message_list))), $sanitize_query); + + // Sanitize email addresses in the init and name columns. + if ($newemail != 'no') { + drush_sql_register_post_sync_op('post-user-init', dt('Reset email based init in user table'), "UPDATE users SET init = mail WHERE init = 'sql-sync';"); + drush_sql_register_post_sync_op('user-name', dt('Reset email based names in user table'), "UPDATE users SET name = mail WHERE name LIKE '%@%';"); + } } // Seems quite portable (SQLite?) - http://en.wikipedia.org/wiki/Truncate_(SQL)