From 67f5cd564997f8e7952f1a9e005d6a322d771b79 Mon Sep 17 00:00:00 2001 From: Riddhesh Sanghvi Date: Fri, 5 Sep 2025 12:35:52 +0530 Subject: [PATCH] feat(backup): add --skip-ssl option to database commands --- src/helper/Site_Backup_Restore.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/helper/Site_Backup_Restore.php b/src/helper/Site_Backup_Restore.php index aa35cd76..eb556ba0 100644 --- a/src/helper/Site_Backup_Restore.php +++ b/src/helper/Site_Backup_Restore.php @@ -362,7 +362,7 @@ private function backup_php_wp( $backup_dir ) { private function backup_db( $backup_dir ) { // Flush MySQL privileges before backup if ( 'running' === \EE_DOCKER::container_status( GLOBAL_DB_CONTAINER ) ) { - EE::exec( 'docker exec -it ' . GLOBAL_DB_CONTAINER . " bash -c 'mysql -uroot -p\$MYSQL_ROOT_PASSWORD -e\"FLUSH PRIVILEGES\"'" ); + EE::exec( 'docker exec -it ' . GLOBAL_DB_CONTAINER . " bash -c 'mysql --skip-ssl -uroot -p\$MYSQL_ROOT_PASSWORD -e\"FLUSH PRIVILEGES\"'" ); } EE::log( 'Backing up database.' ); @@ -463,7 +463,7 @@ private function restore_db( $sql_file, $container_path ) { $sql_path = "/var/www/$container_path/" . basename( $sql_file ); // Use basename for safety // Corrected command with proper escaping and error suppression for password - $restore_command = sprintf( "mysql -u '%s' -p'%s' -h '%s' '%s' < '%s' 2>/dev/null", $db_user, $db_password, $db_host, $db_name, $sql_path ); + $restore_command = sprintf( "mysql --skip-ssl -u '%s' -p'%s' -h '%s' '%s' < '%s' 2>/dev/null", $db_user, $db_password, $db_host, $db_name, $sql_path ); $args = [ 'shell', $site_url ]; $assoc_args = [ 'command' => $restore_command ]; @@ -775,7 +775,7 @@ private function get_db_size() { $this->fs->dumpFile( $query_file, $query ); - $command = sprintf( "mysql -u %s -p%s -h %s %s < /var/www/htdocs/db_size_query.sql", $user, $password, $host, $db_name ); + $command = sprintf( "mysql --skip-ssl -u %s -p%s -h %s %s < /var/www/htdocs/db_size_query.sql", $user, $password, $host, $db_name ); $output = EE::launch( "ee shell " . $this->site_data['site_url'] . " --skip-tty --command=\"$command\"" );