Last updated on

Total Upkeep is a popular WordPress plugin that offers comprehensive backup, restoration, and maintenance features for your WordPress website. While the plugin provides a user-friendly interface within the WordPress dashboard, it also supports integration with WP-CLI (WordPress Command Line Interface) for more advanced users.

This guide will walk you through the steps of using WP-CLI commands with Total Upkeep.

Prerequisites:

  1. WordPress installed on your server.
  2. Total Upkeep plugin installed and activated.
  3. WP-CLI installed on your system.

 

Step 1: Verify WP-CLI Installation:

Before you can start using WP-CLI commands, ensure that WP-CLI is installed and configured correctly on your system. Open your terminal or command prompt and type the following command:

wp --info

This command will display information about your WP-CLI installation. If you see the version number and other details, you’re ready to move on to the next step. Otherwise, refer to the WP-CLI documentation for installation instructions.

Step 2: Connect WP-CLI with Your WordPress Site

To use WP-CLI commands with your WordPress site, you need to establish a connection. Navigate to your WordPress directory using the terminal or command prompt and run the following command:

wp total-upkeep auth

This command will prompt you to enter your Total Upkeep API key. You can find your API key in the Total Upkeep plugin settings within the WordPress dashboard. Paste your API key and press Enter. Once the authentication is successful, you’re ready to utilize WP-CLI commands with Total Upkeep.

Step 3: Perform Basic Total Upkeep Operations

Now that you’re connected, you can perform various Total Upkeep operations using WP-CLI commands. Here are a few examples:

Create a Backup:

To create a backup of your WordPress site using Total Upkeep, run the following command:

wp total-upkeep backup create

This command will initiate a backup process, and you’ll see the progress displayed in the terminal or command prompt. Once the backup is complete, you can find it in the Total Upkeep dashboard or the designated backup storage location.

Restore a Backup:

If you need to restore a backup using Total Upkeep, use the following command:

wp total-upkeep backup restore [backup-id]

Replace [backup-id] with the ID of the backup you want to restore. You can find the backup ID in the Total Upkeep dashboard or by running the wp total-upkeep backup list command.

List Backups

To view a list of available backups created by Total Upkeep, use the following command:

wp total-upkeep backup list

This command will display details such as backup ID, creation date, and size for each backup.

Run Maintenance Tasks:

Total Upkeep includes various maintenance tasks to optimize your WordPress site. To run these tasks, execute the following command:

wp total-upkeep maintenance run

This command will trigger the maintenance tasks configured in Total Upkeep, such as cleaning up expired backups, optimizing the database, and removing temporary files.

Explore Additional WP-CLI Commands

Level Integer Description
LOG_EMERG 0 System is unusable.
LOG_ALERT 1 Action must be taken immediately.
LOG_CRIT 2 Critical conditions.
LOG_ERR 3 Error conditions.
LOG_WARNING 4 Warning conditions.
LOG_NOTICE 5 Normal, but significant, condition.
LOG_INFO 6 Informational message.
LOG_DEBUG 7 Debug-level message.

 

[user@host wp-content/boldgrid-backup]$ php cli/bgbkup-cli.php check log log_level=LOG_DEBUG
Info: No action taken.

 

[user@host wp-content/boldgrid-backup]$ cat cli/bgbkup-cli.log
2019-05-02 09:49:05 [INFO] Operational mode set to "check".
2019-05-02 09:49:05 [INFO] Chosen restoration method: "ziparchive".
2019-05-02 09:49:05 [DEBUG] Gathered information.
2019-05-02 09:49:06 [INFO] Info: No action taken.

Email Notification

An argument flag notify can be passed to enable email notification when there is a failed Site Check. An email message is sent to the specified email address via command argument.

[user@host wp-content/boldgrid-backup]$ php cli/bgbkup-cli.php check log notify email=user@example.com

Auto Recovery

A command argument auto_recovery can be passed set to either 0 or 1, which will trigger an automatic restoration from the last full backup archive if a Site Check has failed.

[user@host wp-content/boldgrid-backup]$ php cli/bgbkup-cli.php check auto_recovery=1

Restore Backups

As of Total Upkeep 1.9.0, a restoration script is included so that backups can be restored outside of WordPress. For example, if WordPress has crashed, the standard restoration script will not work as it relies on WordPress. The new restoration script allows backups to be restored in the event WordPress itself has been corrupted.

Restore using the last full backup

 

[user@host wp-content/boldgrid-backup]$ php cli/bgbkup-cli.php restore

Starting restoration process...
Attempting to restore "https://domain.com" from backup archive file "/home/user/boldgrid_backup/backup.zip"...
Cannot reach the site URL; using standalone restoration process...
Attempting file restoration using PHP ZipArchive...
Success.
Attempting to restore database using PHP PDO...
Success.

Restore using a specific zip file

Force a site restoration using a specific ZIP file.

[user@host wp-content/boldgrid-backup]$ php cli/bgbkup-cli.php restore zip=/home/user/boldgrid_backup/backup.zip
Starting restoration process...
Attempting to restore "https://domain.com" from backup archive file "/home/user/boldgrid_backup/backup.zip"...
Cannot reach the site URL; using standalone restoration process...
Attempting file restoration using PHP ZipArchive...
Success.
Attempting to restore database using PHP PDO...
Success.

 

SIGNUP FOR

BOLDGRID CENTRAL  

   200+ Design Templates + 1 Kick-ass SuperTheme
   6 WordPress Plugins + 2 Essential Services

Everything you need to build and manage WordPress websites in one Central place.

Leave a Reply

Your email address will not be published. Required fields are marked *