Check the latest backup before risky work

MaintenanceBeginner~2 min

Before you start

Plugin version 1.13.0 or newer, and UpdraftPlus as the site's backup plugin. Enable Backup status and List backups on the Abilities tab; both start off and need a user who can manage options. Both are refused on a multisite network. Neither tool can start a backup.

The best time to check a backup is right before you need one. If an agent is about to delete old posts or rewrite fifty pages, you want to know there is a recent copy of the database you could go back to.

This prompt asks before the risky work starts and stops the job if the answer is no.

The prompt
Before we start [deleting the 2019 drafts], check the backups. Only read.
Read the backup status. Tell me whether a backup is running, waiting, stalled
or stopped without finishing, and how old the newest good backup from the last
24 hours is, and which check it passed.
List the recent backup sets: when each started, whether it holds the database
only or files too, its size, where it is kept, and the result of each check.
Then answer in one line: is there a good database backup from the last 24
hours? If not, stop here, do not start the work, and tell me to run a backup in
UpdraftPlus first.

Why this is safe to run

Both tools are reads and neither can start a backup. They never return file names, paths, download links, storage settings or credentials. The status tool compares a small database file with its checksum on the spot; List backups never computes a checksum, so a small backup can show as pending there while Backup status already reports it as verified. That is expected.

A backup kept only off-site has no file on this server to check, and one too large to check in time is reported that way rather than passed. If you want this check enforced for certain tools instead of asked for, turn on the backup gate for destructive tools.

Already connected? Ask your agent for the “check the latest backup before risky work” recipe before any bulk change.

How it works

  1. Read the backup status: whether a backup is running, stalled or stopped early, and how old the newest good backup from the last 24 hours is.
  2. List the recent backup sets with what each holds and where it is kept.
  3. Say plainly whether there is a good database backup from the last 24 hours.
  4. If there is not, stop and tell you to run one in UpdraftPlus.

Questions

What counts as a good backup?
Its job finished, it holds the database, and the database file on this server has exactly the size UpdraftPlus recorded and matched the checksum UpdraftPlus recorded when it was checked. A small file is compared when Backup status runs; others are compared by a background check about once an hour, and until then the backup shows as pending.
Does a database backup cover my uploads and plugins?
No. A database-only backup does not protect files such as plugins, themes or uploads. List backups says whether each set holds the database only or files too. Its files check compares sizes only.
Can the agent take a backup for me?
No. These tools cannot start a backup. Run one in UpdraftPlus or let its schedule do it, then ask again.