Skip to content

Restore a backup

A restore needs a database backup (the .sql.gz file from Database backups), your config.php, the data folder and two folders kept next to the site folder: .clientfence-ticket-files (ticket attachments) and .clientfence-receipts (payment receipts clients uploaded).

  1. Create an empty database and a user for it.

  2. Import the backup:

    Terminal window
    gunzip < your-backup.sql.gz | mysql -u USER -p DATABASE
  3. Upload the ClientFence files of the release you were running, including .htaccess.

  4. Put back your config.php. If the database name, user, password or address changed, update them in its db section, and url if the domain changed.

  5. Put back the data folder (uploaded files and logs).

  6. Put back .clientfence-ticket-files and .clientfence-receipts next to the site folder (not inside it). The database backup does not hold these files.

  7. On a new server, add the cron line.

  8. Sign in again (sign-ins are not in the backup) and open System health. Encryption key must pass.

Before an update, ClientFence saves a backup in .clientfence-backups/<site folder name> next to the site folder, in a folder named update-<old>-to-<new>-<date>-<time>. Only the newest one is kept. It holds:

File What it is
database.sql.gz The database just before the update.
files.zip Every file the update replaced.
added.json The files the update added.
  1. Put the site into maintenance. Save a copy of the current database and site files before replacing them. Import database.sql.gz into a separate empty database first.
  2. Unzip files.zip over the site folder.
  3. Delete the files listed in added.json.
  4. Point config.php to the restored database. Sign in, follow any Finalize Update prompt, and check System Health. Confirm a recent invoice and a file attachment open before taking the site out of maintenance.