This Bundle provides an console command to do easy backups of the contao database.
The backups can be downloaded in the backend and backups can be created manually by backend users.
Automatic backups are triggered by the daily contao cronjob automator.
Install the bundle via Composer:
composer require bwein-net/contao-database-backup
You can do backups with the following command:
vendor/bin/contao-console bwein:database:backup [backupType] [filename]
There are two optional parameters backupType
and filename
.
The default backupType
is manual
but you can also use one of the other allowed types: auto
, deploy
, migration
By the backupType
the dumper decides in which subfolder the backups are stored.
The default backup folder is var/db_backups
.
If the filename is empty, the fallback will be database_name_Y-m-d_H-i-s
. The file extension has to be empty, because .sql.gz
is always added.
The auto
backup is triggered by the daily contao cronjob automator.
In the config/config.yml
you can add the following optional parameters:
# config/config.yml
bwein_database_backup:
max_backups: 5
download_filename_current: 'bwein_database'
The default of max_backups
is 7
backups per type - 0
deactivates the automatic purge.
The download filename of the current backup can optionally be configured with download_filename_current
- default with value ''
would be current.sql.gz
. In the example the filename would be 'bwein_database.sql.gz'
. The file extension .sql.gz
is always added.
- PHP 7.0
mysqldump
as global command-line binarygzip
as global command-line binary