What's the best Non-WP-CLI export method for WP-CLI import?
Backstory: I've been using Basic WordPress Vagrant Environment for local testing and recently the author added WP-CLI. The more I've been playing around with it the more I'm in love. I even went so far as to create a bash script to spin up new Vagrant boxes using just a name.
require ABSPATH . 'wp-admin/includes/export.php'; // Buffer output ob_start(); // Generates the WXR export file for download. $defaults = array ( 'content' => 'all', 'author' => false, 'category' => false, 'start_date' => false, 'end_date' => false, 'status' => false, ); export_wp( $defaults ); // Get the buffer contents $xml_export_data = ob_get_clean(); echo $xml_export_data;
$ wp db export /vagrant/site/site_export.sql Success: Exported to /vagrant/site/site_export.sql
The easiest route for my main (most important server) is to just do a mysqldump directly through SSH.
# backup: mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql # restore: mysql -u root -p[root_password] [database_name] < dumpfilename.sql
I'm just not sure that the regular SQL dump will hold all the values required for a WP-CLI import.
mysqldump could be the only thing needed. Now I'm thinking I should have transferred over all the files before import... I'll keep ya'll posted but this could be a two-line process.