Skip to content

Commit 0438baf

Browse files
committed
A fix to the implode() of sanitize queries.
1 parent 8ed8452 commit 0438baf

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

commands/sql/sql.drush.inc

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -463,21 +463,22 @@ function drush_sql_sanitize() {
463463
}
464464

465465
drush_command_invoke_all('drush_sql_sync_sanitize', 'default');
466-
$options = drush_get_context('post-sync-ops');
467-
if (!empty($options)) {
466+
$operations = drush_get_context('post-sync-ops');
467+
if (!empty($operations)) {
468468
if (!drush_get_context('DRUSH_SIMULATE')) {
469469
$messages = _drush_sql_get_post_sync_messages();
470470
if ($messages) {
471471
drush_print();
472472
drush_print($messages);
473473
}
474474
}
475+
$queries = array_column($operations, 'query');
476+
$sanitize_query = implode(" ", $queries);
475477
}
476478
if (!drush_confirm(dt('Do you really want to sanitize the current database?'))) {
477479
return drush_user_abort();
478480
}
479481

480-
$sanitize_query = explode(' ', $options);
481482
if ($sanitize_query) {
482483
$sql = drush_sql_get_class();
483484
$sanitize_query = $sql->query_prefix($sanitize_query);
@@ -525,17 +526,14 @@ function drush_sql_register_post_sync_op($id, $message, $query = NULL) {
525526
* All post-sync operation messages concatenated together.
526527
*/
527528
function _drush_sql_get_post_sync_messages() {
528-
$messages = FALSE;
529-
530-
$options = drush_get_context('post-sync-ops');
531-
if (!empty($options)) {
529+
$messages = '';
530+
$operations = drush_get_context('post-sync-ops');
531+
if (!empty($operations)) {
532532
$messages = dt('The following operations will be done on the target database:') . "\n";
533533

534-
foreach($options as $id => $data) {
535-
$messages .= " * " . $data['message'] . "\n";
536-
}
534+
$bullets = array_column($operations, 'message');
535+
$messages .= " * " . implode("\n * ", $bullets) . "\n";
537536
}
538-
539537
return $messages;
540538
}
541539

0 commit comments

Comments
 (0)