About Cronjob Database Backup

Periodic automatic backup of the database. Set interval in settings.

Category 1Admin Helpers
Admin helper modules are those that provide helpful tools, UI enhancements or optimizations to the admin panel (excluding Fieldtype or Inputfield modules).
Category 2Development Tools
Modules that have more to do with assisting development of a site rather than managing its content.
Category 3Process Modules
Process modules are apps that run in the ProcessWire admin.
Category 4Proof of Concept
Proof of concept modules are designed as examples or starting points for others to build from. May not be ideal for users wanting to plug-n-play.
Release StateStable
Should be safe for use in production environments. *
Authorkixe
Module Version1.1.5
Class NameCronjobDatabaseBackup
Compatibility2.5, 2.6, 2.7, 3.0
Date AddedNovember 7, 2014
Last UpdatedNovember 28, 2016
Recommended ByNew recommendations may take up to 1 day to appear.

Instructions

This module's files should be placed in /site/modules/CronjobDatabaseBackup/
How to install or uninstall modules

README

CRONJOB DATABASE BACKUP

Auto backup of your database. Triggered periodically by a cycle interval or via user logout.
Use 'Process Database Backup Module' to restore from backup or delete them.
This module could slow down your processes since backups may take some time,
depending on how much there is to backup. This cronjob (hooks on LazyCron) is executed by a call to module: ProcessPageView.

Each run is logged in site/assets/logs/messages.txt.

Settings

  • Backup Trigger
    Select a time interval for automated database backups or the option 'logout trigger' to force download after a user with 'db-backup' permission assigned has been logged out. Permission 'db-backup' will be added with module installation. If you want to disable automated backups choose 'never'. No need to uninstall the module for this. (default: every 4 weeks)
  • Maximum Number of Backups
    Select how many backups you want to keep in the storage. Minimum 1, default and maximum 100 (defined in constant MAXFILES). Executed with each cron.
  • Remove backups older than
    Will remove backups older than selected time interval with each cron.
  • Backup Name
    Choose a name for the backup files. No older file will be overwritten. If left blank default setting is the name of the database (set in config) with a number suffix (counter) to make it unique. Name format syntax: # placeholder for db-name. Escape date() format with surrounding %. If filename exists a unique filename will be generated: [filename]-[n].sql. Allowed types: A-Z, a-z, 0-9, #, %, dash and underscore.
  • Backup Fileinfo
    Define custom fileinfo string here. Format syntax: # placeholder for db-name. Escape date() format with surrounding %. Any $user property surrounded with curled brackets will be replaced by the corresponding value. If left blank default setting will be 'backup made by CronjobDatabaseBackup'.
  • Storage Path
    Path to custom storage directory. If left blank or path doesn't exist default pass will be used. (The Path is displayed under the field. Normally: /site/assets/backups/database/)
  • Tables
    By default, the backup will include all tables. If you only want certain tables to be included, select them from the list.
  • Remove backups now
    Select how many backups you want to keep in storage. Klick SAVE to execute.

Require

LazyCron.module

Not a real requirement but ProcessDatabaseBackups.module is useful to restore the database from a file or to delete older backup files.
I recommend to use both modules.

Thanks :-)

I took some nice code from ProcessDatabaseBackups.module. Thanks to Ryan!

License

GNU-GPLv3

Author

kixe (Christoph Thelen)

Comments

  • MuchDev

    MuchDev 2 years ago 30

    If you are looking at this module then you probably want it. This creates a native processwire database backup based on the interval of your choosing. I have yet to have any issues. If a user somehow manages to screw up some data and they want to roll back, the file will be right there for you.

Post a Comment

Your e-mail is kept confidential and not included with your comment. Website is optional.