From 8c4a05e01c2658c18e7ce3aa99181c3bfd98bf5c Mon Sep 17 00:00:00 2001 From: Roman Axelrod Date: Tue, 8 Jul 2025 12:18:24 -0600 Subject: [PATCH] Backup DB before any operation. --- wp-import.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wp-import.php b/wp-import.php index 3b07ada..2e27ce2 100644 --- a/wp-import.php +++ b/wp-import.php @@ -6,6 +6,9 @@ if ( ! file_exists( 'wp-content/mysql.sql' ) ) { return; } +// Create backup of the current database. +echo shell_exec( 'wp db export ./wp-content/mysql-backup.sql' ); + $staging_domain = shell_exec( 'wp option get siteurl' ); echo shell_exec( 'wp db import ./wp-content/mysql.sql' );