BD Backup

Restoring from a Backup

Updated March 9, 2026 7 min read

Before You Restore

Restoring from a backup replaces your current database and files with the contents of the backup archive. This is a significant operation, so keep the following in mind:

  • A pre-restore database snapshot is created automatically. Before importing the backup’s database, BD Backup exports your current database to a SQL file stored in the restore temp directory. This provides a safety net if something goes wrong.
  • The site enters maintenance mode during restore. A .maintenance file is placed in your WordPress root directory, which makes WordPress show a “Briefly unavailable for scheduled maintenance” message to visitors. This file is removed automatically when the restore completes or is cancelled.
  • wp-config.php is never overwritten. Your current wp-config.php file is always preserved during restore. This ensures your database credentials, security keys, and other critical configuration remain intact.
  • Critical options are preserved across database import. During the database import, the plugin saves and then restores three important options: active_plugins (so your plugins remain active), bdbk_settings (so BD Backup keeps its configuration), and permalink_structure (so your URLs keep working).

Important: You can only restore from backups that have a status of “complete” and whose ZIP file still exists on disk. Failed, cancelled, or deleted backups cannot be restored.

How to Restore from a Backup

  1. Navigate to BD Backup in your WordPress admin sidebar.
  2. Click the History tab.
  3. Find the backup you want to restore from. Use the status filter to show only “Complete” backups if needed.
  4. Click the Restore button in the Actions column for that backup entry.
  5. A confirmation dialog appears with the message: “Restore from this backup? The site will enter maintenance mode during restore. A pre-restore database snapshot will be created automatically.” Click OK to proceed.
  6. The progress bar appears on the Dashboard tab and begins updating as the restore moves through its phases.
  7. When the progress bar reaches 100%, you see a “Restore complete! Site has been restored successfully.” message. The page reloads automatically.

What Happens During a Restore

The restore engine processes the operation in the following phases:

Phase 1: Extracting

The backup ZIP file is extracted to a temporary directory inside wp-content/uploads/backups-bdbk/tmp/restore-{id}/extracted/. PclZip handles the extraction. If extraction fails (corrupted ZIP, insufficient disk space), the restore stops with an error and maintenance mode is disabled.

Phase 2: Pre-Checks

The restore engine verifies the extracted backup is valid by checking for a manifest.json file. This manifest contains metadata about the backup, including the plugin version, backup type, WordPress version, site URL, and creation date. If the manifest is missing or invalid, the restore is aborted. Maintenance mode is then enabled by creating the .maintenance file.

Phase 3: Importing Database

This phase only runs if the backup contains a database.sql file (both full and database-only backups include one). The steps are:

  1. Preserve critical options — the current values of active_plugins, bdbk_settings, and permalink_structure are saved to memory.
  2. Create pre-restore snapshot — your entire current database is exported to a SQL file (pre-restore-snapshot.sql) stored in the restore temp directory. This runs to completion (up to 500 export chunks) before any changes are made.
  3. Execute the SQL import — the database.sql file from the backup is read line by line. Each complete SQL statement (terminated by a semicolon) is executed against the database. Comments and blank lines are skipped. This includes DROP TABLE and CREATE TABLE statements, so existing tables are replaced.
  4. Restore preserved options — after the import, the WordPress object cache is flushed and the three preserved options are written back, ensuring the site remains functional with the same active plugins, BD Backup settings, and permalink structure.

Technical note: The restore engine stores its state in a JSON file on disk (wp-content/uploads/backups-bdbk/restore-state.json) rather than in the WordPress options table. This is because the database import drops and recreates the options table, which would destroy any option-based state.

Phase 4: Copying Files

This phase only runs for full-site backups (not database-only). The restore engine:

  1. Builds a list of all extracted files, excluding manifest.json, database.sql, and wp-config.php.
  2. Copies files from the extracted directory to their original locations in the WordPress installation, 500 files at a time.
  3. Creates any missing directories as needed.
  4. Existing files at the destination are overwritten with the backup versions.

Phase 5: Verifying

After all data is restored, the engine verifies that three critical files exist in the WordPress root:

  • wp-config.php
  • wp-settings.php
  • index.php

If any of these are missing, the restore fails with an error listing the missing files. If verification passes:

  1. Permalink rewrite rules are flushed so URLs regenerate correctly.
  2. The temporary extraction directory is deleted.
  3. The .maintenance file is removed, bringing the site back online.
  4. The restore lock is released and the state file is deleted.

Downloading Backup Files

You can download any completed backup to your local computer for off-site storage:

  1. Go to the History tab on the BD Backup dashboard.
  2. Find the backup you want to download (must have “Complete” status).
  3. Click the Download button in the Actions column.
  4. The ZIP file is served directly through WordPress with proper security checks (admin permission verification and nonce validation). Your browser will download the file.

Downloaded backup files can be stored on an external drive, cloud storage, or another server as an extra layer of protection.

Tip: Regularly download backups to an off-site location. Local backups protect against software issues, but if your server’s storage fails, both your site and your backups could be lost.

Deleting Backups

To manually delete a backup you no longer need:

  1. Go to the History tab.
  2. Click the Delete button for the backup entry.
  3. Confirm the deletion when prompted with: “Delete this backup? This cannot be undone.”

Deleting a backup removes both the ZIP file from disk and the log entry from the database. This action cannot be reversed.

Cancelling a Restore

If a restore is in progress, a Cancel Restore button appears in the progress section. Clicking it:

  1. Deletes the temporary extraction directory and all extracted files.
  2. Removes the restore state file.
  3. Releases the restore lock.
  4. Removes the .maintenance file, bringing the site back online.

Warning: If you cancel a restore after the database import phase has already completed, your database will contain the backup’s data but your files may be a mix of old and new. In this situation, you should either re-run the restore to completion or use the pre-restore database snapshot to roll back.

What Gets Restored (Summary)

Full Backup Restore

  • All database tables (dropped and recreated from the backup)
  • All files from the backup (overwriting existing files)
  • wp-config.php is NOT touched
  • Active plugins list, BD Backup settings, and permalink structure are preserved from the current site

Database Only Restore

  • All database tables (dropped and recreated from the backup)
  • No files are modified
  • wp-config.php is NOT touched
  • Active plugins list, BD Backup settings, and permalink structure are preserved from the current site

Troubleshooting

“Another backup is already in progress”

This error appears when the backup lock is held. Only one backup or restore can run at a time. If you believe the previous operation has stalled, wait 10 minutes for the lock to expire automatically. Locks have a 10-minute timeout and are automatically cleared if they become stale.

“A backup is currently in progress” (when trying to restore)

You cannot start a restore while a backup is running. Wait for the backup to finish, cancel it, or wait for the lock to expire.

“Backup file not found on disk”

The backup log entry exists but the ZIP file has been deleted from the server. This can happen if someone manually deleted files from wp-content/uploads/backups-bdbk/, or if the file was removed during a hosting migration. The backup cannot be restored. Delete the orphaned log entry from the History tab.

“Backup manifest not found”

The extracted ZIP does not contain a manifest.json file. This typically means the ZIP file is corrupted, was modified externally, or was not created by BD Backup. Try downloading the backup file and verifying its integrity.

“Critical files missing after restore”

The verification phase detected that one or more of wp-config.php, wp-settings.php, or index.php are missing from the WordPress root after the restore. This usually indicates the backup itself was incomplete. Check the original backup to see if it contains these files. Note that wp-config.php is always preserved from the current site (never overwritten), so it should always pass this check.

“PclZip class is not available”

The PclZip library could not be loaded. BD Backup attempts to load it from wp-admin/includes/class-pclzip.php, which is part of every WordPress installation. If this file is missing, your WordPress core files may be damaged. Try reinstalling WordPress core files via the Dashboard → Updates page.

“Backup directory is not writable”

The plugin cannot write to wp-content/uploads/backups-bdbk/. Check that the wp-content/uploads/ directory has correct file permissions (typically 755 for directories). On shared hosting, contact your provider if you cannot set permissions.

Backup fails with timeout errors

If your backups consistently fail during the database export or file archiving phases, your server’s PHP execution time limit may be too low. Try these steps:

  1. Go to Settings tab in BD Backup.
  2. Under Performance Tuning, reduce Database rows per chunk to 500.
  3. Reduce Tables per batch to 3.
  4. Save settings and try again.

If the issue persists, try running a Database Only backup first to confirm the database export works, then attempt a full backup.

Restore seems stuck

If the progress bar stops moving during a restore, the AJAX request may have timed out. Try refreshing the page. If the restore state file still exists, the plugin will detect the in-progress restore and allow you to continue or cancel. If the restore lock has expired (after 10 minutes of no activity), you can start fresh.

Site shows “Briefly unavailable for scheduled maintenance”

This happens when the .maintenance file is left behind after a failed or cancelled restore. To fix it:

  1. Connect to your site via FTP or your hosting file manager.
  2. Navigate to the WordPress root directory.
  3. Delete the file named .maintenance.
  4. Your site will immediately come back online.

Tip: After restoring from a backup, clear any caching plugins and your browser cache to ensure you see the restored content. If you use a CDN, purge the CDN cache as well.