This commit modifies the upload_to_b2 method in the MysqlDatabaseBackup class to search for an existing backup file with the same name as the backup file being uploaded in a specified Backblaze B2 bucket. The implementation retrieves a list of all files in the bucket using the b2 ls command and then iterates over each line to search for a file with the same name as the backup file. If a matching file is found, the implementation extracts its file ID using a regular expression and then uses the b2 delete-file-version command to delete the file from the bucket. Note that this implementation assumes that the backup file has a unique name.
This commit addresses two main issues:
The 'b2_enabled' value was not being stored in the config JSON. Added it to the config JSON to enable or disable B2 bucket uploads as needed.
Corrected the execution of b2-cli commands in the MysqlDatabaseBackup class using backticks for proper shell command execution in Ruby.
These changes should resolve the issue of the database dump file not being uploaded to the B2 bucket.