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

Improve restore sanitization - Fixes [sc-24840] #15168

Merged
merged 1 commit into from
Jul 25, 2024

Conversation

uberbrady
Copy link
Collaborator

Some older version of MySQL dump INSERT statements as:

INSERT INTO `blah` VALUES
(blah,blah,blah),
(blah,blah,blah),
(blah,blah,blah);

And we were unable to parse that.

Additionally, while MySQL can easily handle \r\n or \n line-endings, our regex validator was getting confused by \r\n, so now we trim them off and normalize them to just \n.

Also, since I was debugging the SQL sanitizer, I re-added back in a --sql-stdout-only command-line option that only sanitizes the SQL and dumps the result to STDOUT - which should make this easier to debug in the future.

Copy link

what-the-diff bot commented Jul 25, 2024

PR Summary

  • Implementation of newline character update
    The parse_sql method in RestoreFromBackup.php has been improved with an incorporated new format for its text output. This reformatting includes appending a newline character at the end of method lines, aiding overall readability.

  • Removal of newline character
    Contrastingly, a newline character previously present at the end of method lines has been removed. This adjustment helps to maintain optimal formatting, eliminating any additional spaces that might not be necessary.

  • Addition of new command line flag
    The handle method in RestoreFromBackup.php has been updated with a --sql-stdout-only flag. This addition enhances the script's functionality by offering users a new command line option to increase flexibility when performing operation with the script.

Copy link
Owner

@snipe snipe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you!

@snipe snipe merged commit 129d3b3 into snipe:develop Jul 25, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants