All-in-One WP Migration Google Drive Extension WP CLI Integration

All-in-One WP Migration Google Drive Extension WP CLI Integration

WP Migration All-in-One The Google Drive Extension includes WP-CLI integration, allowing you to run migrations from the command line. It adds backup and restore commands that can be executed from the command line.

Backup

Creates a new backup file.
Example: wp ai1wm gdrive backup.

OPTIONDESCRIPTIONEXAMPLE
[--sites]Create a new backup file for WP Multisite ( Sub-Sites/Subdomain-Sites ) wp ai1wm gdrive backup --sites
[--exclude-spam-comments]Creates a backup file without spam commentswp ai1wm gdrive backup --exclude-spam-comments
[--exclude-post-revisions]Creates a backup file without post revisionswp ai1wm gdrive backup --exclude-post-revisions
[--exclude-media]Creates a backup file without media library fileswp ai1wm gdrive backup --exclude-media
[--exclude-themes]Creates a backup file without any themes.wp ai1wm gdrive backup --exclude-themes
[--exclude-inactive-themes]Creates a backup file without currently inactive themes.wp ai1wm gdrive backup --exclude-inactive-themes
[--exclude-muplugins]Creates a backup file without must-use plugins.wp ai1wm gdrive backup --exclude-muplugins
[--exclude-plugins]Creates a backup file without plugins.wp ai1wm gdrive backup --exclude-plugins
[--exclude-inactive-plugins]Creates a backup file without currently inactive plugins.wp ai1wm gdrive backup --exclude-inactive-plugins
[--exclude-cache]Creates a backup file without cache files.wp ai1wm gdrive backup --exclude-cache
[--exclude-database]Creates a backup file without the database.wp ai1wm gdrive backup --exclude-database
[--exclude-email-replace]Creates a backup file without replacing email domain. wp ai1wm gdrive backup --exclude-email-replace
[--replace "find" "replace"]Finds and replaces text in the database. Use --replace flag before each pair for replacement.wp ai1wm gdrive backup --replace "wordpress" "WordPress"
SIMULTANEOUS USEAll options be used simultaneously except --list can. Replace option could be used between other options. wp ai1wm gdrive backup --exclude-inactive-themes --replace "find" "replace" --exclude-cache --replace "old text" "new text"

List backups

List backup files from Google Drive.
Example: wp ai1wm gdrive list-backups.

OPTIONDESCRIPTIONEXAMPLE
[--folder-path=]List backups in a specific folder. (Folder name is specified in the extension settings).wp ai1wm gdrive list-backups --folder-path=my\ backup/migration

Restore backup

Restore a backup from Google Drive.
Example: wp ai1wm gdrive restore migration-wp-40170913-095743-931.wpress.

OPTIONDESCRIPTIONEXAMPLE
[--folder-path=]Download a backup from a specific folder inside cloud storage. (Folder name is specified in the extension settings). wp ai1wm gdrive restore migration-wp-49270913-995743-939.wpress --folder-path=my\ backup/migration
[--yes]Auto-confirm the backup on restore.wp ai1wm gdrive restore migration-wp-49270913-995743-939.wpress --yes

Configure your backup plans

Note ⇒ You need to run both the commands:

Every Hour
The first command creates a scheduled cronjob for backup: wp cron event schedule ai1wmge_gdrive_hourly_export now hourly.
The second one updates our extension settings : wp option update ai1wmge_gdrive_cron ‘[“hourly”]’ –format=json.

Every Day
The first command creates a scheduled cronjob for backup: wp cron event schedule ai1wmge_gdrive_daily_export now daily.
The second one updates our extension settings : wp option update ai1wmge_gdrive_cron ‘[“daily”]’ –format=json .

Every Week
The first command creates a scheduled cronjob for backup: wp cron event schedule ai1wmge_gdrive_weekly_export now weekly.
The second one updates our extension settings :wp option update ai1wmge_gdrive_cron ‘[“weekly”]’ –format=json.

Every Month
The first command creates a scheduled cronjob for backup: wp cron event schedule ai1wmge_gdrive_monthly_export now monthly.
The second one updates our extension settings :wp option update ai1wmge_gdrive_cron ‘[“monthly”]’ –format=json.

Backup Time
To change backup time (unix timestamp): wp option update ai1wmge_gdrive_cron_timestamp 1650534475
The particular time of the day when you want the backup to be carried out needs to be converted to unix timestamp format which is represented as seconds

Retention settings

To keep the most recent backup: wp option update ai1wmge_gdrive_backups 1.
To limit the size of backup: wp option update ai1wmge_gdrive_total 1GB.
To remove backups older than X days: wp option update ai1wmge_gdrive_days 10

Note: You can change the number of recent backups and the size of the backup as your needs dictate.

 

 

8 Comments

  1. Tom af Hällström

    Is it possible to handle retention from the command-line, as in the web-interface? For instance, leave only 5 newest backups on gdrive.

    1. Ugyen Dorji

      Yes, you could use WP-CLI to change the retention settings
      : wp option update ai1wmge_gdrive_backups 5

  2. Thomas Herod

    If I use the Google Drive extension to backup my website, will that prevent the plugin from also leaving backups on my hosting server?

Leave A Comment?