This is a WP-CLI based backup solution for WordPress. You can create backups of the files and the DB, and restore the sites back from them.
With the alias function of the WP CLI, this command helps you to reduce workload on managing multiple sites.
$ wp @all vackup create
See more about alias: https://make.wordpress.org/cli/handbook/config/#config-files
- WP-CLI 0.23 or later
$ mkdir -p ~/.wp-cli/commands && cd -
$ git clone git@github.com:vccw-team/wp-cli-vackup.git
Add following into your ~/.wp-cli/config.yml
.
require:
- commands/wp-cli-vackup/cli.php
You can configure the default directory to store backups.
vackup:
dir: /Users/miya0001/backups
See more about configuration: https://make.wordpress.org/cli/handbook/config/
wp vackup create
: Create a .zip archive from WordPress. It contains files and database.wp vackup restore
: Restore the WordPress site from a .zip archive.wp vackup server
: Launch a temporary WordPress site with PHP built-in web server.
The file name of the archive will be generated from home_url()
and a timestamp.
$ wp vackup create --dir=path/to/dir
The archive file name will be path/to/dir/example.com-20170101000000.zip
.
$ wp vackup restore <file>
You'd sometimes need wp search-replace
, for example when you create a backup from production and restore it to dev environment.
$ wp vackup server /path/to/backup.zip
Then visit http://localhost:8080/.
NAME
wp vackup
DESCRIPTION
CLI based backup solution for WordPress
SYNOPSIS
wp vackup <command>
SUBCOMMANDS
create Create a `.zip` archive of a WordPress install.
restore Restore the WordPress site from backup.
server Launch WordPress from backup file with PHP built-in web server.
$ wp package update