Skip to content

Instantly share code, notes, and snippets.

@jonpugh
Created October 16, 2019 23:55
Show Gist options
  • Save jonpugh/6455d67d065c369a1f441a77b7ba180d to your computer and use it in GitHub Desktop.
Save jonpugh/6455d67d065c369a1f441a77b7ba180d to your computer and use it in GitHub Desktop.
Manual workaround for database dumps "DEFINER" issue.
# Because of these issues:
# - https://stackoverflow.com/a/44015870/292408
# - https://www.drupal.org/project/workflow_participants/issues/3073354
# A second time because the export has the issue too.
- name: Add this function to /var/aegir/.drush/va.drush.inc
function drush_va_post_sql_dump() {
// BACKEND_RESULT is the full path to the file.
$file_ext_gz = drush_get_context('BACKEND_RESULT');
shell_exec("gunzip $file_ext_gz");
$file_ext_sql = str_replace('.gz', '', $file_ext_gz);
$CMD = <<<CMD
sed 's/\sDEFINER="[^`]*"@"[^`]*"//g' -i $file_ext_sql
CMD;
shell_exec($CMD);
shell_exec("gzip $file_ext_sql");
drush_log('SQL Dump was ungzipped, DEFINER string stripped and gzipped again.', 'notice');
}
@jonpugh
Copy link
Author

jonpugh commented Oct 16, 2019

Something todo with RDS? 🗡️

cc @ElijahLynn

@ElijahLynn
Copy link

ElijahLynn commented Oct 16, 2019

Yeah, the Drupal Workflow Participants module somehow introduced this issue (couldn't find it in source code search), I posted here about it https://www.drupal.org/project/workflow_participants/issues/3073354.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment