Backup & Restore

Regular backups of your LicenceForge data are essential for disaster recovery and safe plugin upgrades. This page covers what to back up, how to export and import data, and important caveats to be aware of when restoring.

Tip

Always create a backup before upgrading the LicenceForge plugin. Database schema migrations run automatically on upgrade and cannot be reversed without a backup.

What to Back Up

A complete LicenceForge backup includes three components: database tables, WordPress options, and product files.

Database Tables

LicenceForge stores data in eight custom tables (prefixed with your WordPress table prefix, typically wp_):

Table Contains
wplf_products Product definitions, slugs, versions, and metadata
wplf_product_prices Pricing tiers and WooCommerce product mappings
wplf_licenses License records, hashed keys, expiry dates, and status
wplf_activations Active site registrations per license
wplf_webhook_events Stripe and WooCommerce webhook event log
wplf_audit_log Audit trail of all license operations
wplf_analytics Validation and activation analytics data
wplf_api_keys API key records and permissions

WordPress Options

LicenceForge stores configuration settings in the wp_options table using the wplf_ prefix. These include rate limits, email settings, retention periods, health alert configuration, and version tracking.

To list all LicenceForge options:

SELECT option_name, option_value
FROM wp_options
WHERE option_name LIKE 'wplf_%';

Product Files

Product ZIP files are stored in one of two locations depending on your configuration:

  • Local storage: wp-content/uploads/licenceforge/
  • S3 storage: Your configured Amazon S3 bucket

Include these files in your backup. Without them, customers cannot download product updates even if the database is intact.

Backing Up with WP-CLI

WP-CLI provides the most convenient way to export LicenceForge tables. The following command exports only the LicenceForge tables to a SQL file:

wp db export \
  --tables=$(wp db tables --format=csv | grep wplf) \
  licenceforge-backup.sql

This dynamically discovers all tables with wplf in their name, accounting for any custom table prefix.

Backing Up with mysqldump

If WP-CLI is not available, use mysqldump directly. Replace USER, DBNAME, and the table prefix as needed:

mysqldump -u USER -p DBNAME \
  wplf_products \
  wplf_product_prices \
  wplf_licenses \
  wplf_activations \
  wplf_webhook_events \
  wplf_audit_log \
  wplf_analytics \
  wplf_api_keys \
  > licenceforge-backup.sql

Note

If your WordPress installation uses a custom table prefix (e.g. wp3_), replace wplf_ with wp3_wplf_ in the table names above.

Backing Up WordPress Options

Export all LicenceForge-related options separately for a complete backup:

wp db query \
  "SELECT option_name, option_value FROM wp_options WHERE option_name LIKE 'wplf_%'" \
  --skip-column-names \
  > licenceforge-options.tsv

Backing Up Product Files

For local storage, copy the uploads directory:

cp -r wp-content/uploads/licenceforge/ /path/to/backup/licenceforge-files/

For S3 storage, use the AWS CLI:

aws s3 sync s3://your-bucket-name/licenceforge/ /path/to/backup/licenceforge-files/

Restoring from Backup

To restore a LicenceForge backup, import the SQL dump into your database:

# Using WP-CLI
wp db import licenceforge-backup.sql

# Using mysql directly
mysql -u USER -p DBNAME < licenceforge-backup.sql

After restoring, copy product files back to the uploads directory (or re-sync to S3).

Critical

If you restore a backup to a server with different wp-config.php authentication keys (AUTH_KEY, AUTH_SALT), all license key hashes and API key hashes will become invalid. License keys stored in the database are HMAC-SHA256 hashes derived from these salts — they cannot be recalculated without the original keys. Always preserve your wp-config.php salts alongside your database backups.

Backup Recommendations

  • Before every plugin upgrade — Create a manual backup of all LicenceForge tables. Schema migrations cannot be reversed without a backup.
  • Daily automated backups — Schedule a daily backup of your entire WordPress database. Most hosting providers offer automated backup solutions.
  • Off-site storage — Store backup files on a separate server, cloud storage bucket, or backup service. Do not rely solely on the same server that hosts WordPress.
  • Test your restores — Periodically verify that your backups can be successfully restored to a staging environment.
  • Preserve wp-config.php — Back up your wp-config.php alongside the database. The authentication salts are required for license key and API key validation after restore.

Related Pages