Site Backup and Restore

Target databases

If you are unsure of the name of the production database, examine the database configuration file:
/public_html/application/config/database.php
Example:

   'server' => 'localhost',
   'database' => 'scymorg_scym',
   'username' => 'scymorg_scym2',

Backup Database with PHPMyAdmin

Backup types

You can do a full backup or partial backups: TABLES, FUNCTIONS, VIEWS.

  1. Full Backups - put 'FULL' in the file name
  2. Tables only backup - put 'TABLES' in the file name
  3. Functions only backup - put 'FUNCTIONS' in the file name
  4. Views only backup - put 'VIEWS' in the file name. Note that views are dependent on tables and functions. So restore them first.

Functions and Views rarely change, so regular backups should be either TABLES or FULL.

Backup procedure

  1. Select the database
  2. Click 'Export' tab
  3. Export Method: Custom
  4. Tables
    • FULL or TABLES only
      • Select all (default)
    • VIEWS only backup:
      • Unselect all
      • Select all begining with 'SCYM_VIEW_'
    • FUNCTIONS only backup
      • Unselect all
  5. Output:
    • File name template: %F-%H%M-@DATABASE@
    • Compression: zipped (for backup on server), None if used for development.
  6. Format-specific options:
    • Disable foreigh key checks: on
  7. Object creation options
    • Full Backup
      • Add create view statement: on
        • Use simple view export: on
        • Exclude definition of current user
        • Add CREATE PROCEDURE / FUNCTION / EVENT statement: on (default)
    • 'TABLES' only Backup
      • Add create view statement: off
      • Add CREATE PROCEDURE / FUNCTION / EVENT statement: off
    • 'FUNCTIONS' only backup
      • Add create view statement: off
      • Add CREATE PROCEDURE / FUNCTION / EVENT statement: on
    • 'VIEWS' only backup
      • Add create view statement: on
        • Use simple view export: on
        • Exclude definition of current user
      • Add CREATE PROCEDURE / FUNCTION / EVENT statement: off
  8. Export and save
    • Add "FULL", "TABLES", or "VIEWS" to the file name depending on backup type.

Backup Files with File Manager

Documents and file uploads

If no code changes have been uploaded, you only need to backup two file system directories:

  • public_html/application/files
  • public_html/application/documents

Using file manager compress these directories to a backup folder: /backup/(date of backup). The date should be in YYYY-MM-DD format. You can select both to compress to a single zip file.

Source Code

We do not regularly backup the code since it is all stored in our GitHub repository. However it is wise to backup to the web server after major changes.

Compress the following directories and store the in /backup/(date of backup)-code.

  • public_html/application
  • public_html/packages

Restore Database with PHPMyAdmin

The target database must contain no Tables or Views. You can create a new one or use phpMyAdmin or other SQL utility to delete all tables, views and functions.

If restoring from partial backups, restore the following in order.

  1. Restore most recent TABLES only backup from the must recent backup directory.
  2. Restore most recent FUNCTIONS only backup from the restore directory.
  3. Restore most recent VIEWS only backup from the restore directory.

View creation will fail if tables and functions are not restored first.

  1. Select database: scymorg_scym
  2. Click 'Import' tab
  3. Choose the backup file to import (.zip or .sql)
  4. Under other options:
    • Turn off: Enable foreign key checks
  5. Click "Import"

Restore Files with FileManager

To a functioning Site

Use file manager to replace the \application\files and \application\documents directory from zip files located in the /backup/(date of backup) directory.

To a blank Site (no files)

  1. Create a new ConcreteCMS site using zip file from the \deploy directory or ConcreteCMS.org.
    See ConcreteCMS Installation

  2. Create the vendor directory under the root directory (above "public_html"), using \deploy\vendor-php8.zip.

  3. Restore custom code from zip files in most recent /backup/(date of backup)-code folder.