BackupDB for Contao 5 (EN) - do-while/contao-BackupDB GitHub Wiki
contao-BackupDB
Backup of the Contao database, automatic backup, creation of website template for the install tool
This module extends the system section in the back end.
Download MySQL Backup
With a mouse click the entire database can be easily saved. The backup file is obtained as a download in order to save it outside the web server, e.g. on your own PC.
Automatic backup
With a server cronjob, it is possible to run regular backups of the database and save them on the webspace. To do this, call the following URL with cron:
http://www.myDomain.tld/BackupDB/autobackup
To prevent spamming, you can enter an identifier in the settings, which must be given as a variable to the AutoBackup call. Without this variable no backup will be created. This allows you to customize the call.
Example: Input in the settings "Individual call parameter": mEXde3iD Call: http://www.meineDomain.tld/BackupDB/autobackup?mEXde3iD
Create website template
In addition, also website templates for the install tool can be saved. These website templates can be loaded in the install tool of Contao.
ATTENTION! The website templates are NOT for transferring a backup to another Contao release, because the different database structures exist.
Settings
There is a section "BackupDB settings" in the Contao settings. The backup can be configured here.
Blacklist for backups
For larger databases, it may happen that the maximum execution time of the script is exceeded and the backup is aborted by the server. The backup is not successful. The Blacklist can be used to prevent the data that is not necessarily needed during recovery. The table contents of tl_log, tl_search, tl_search_index, tl_session, tl_undo and tl_version are not relevant for the emergency and need not necessarily be saved. For example, by skipping the search index, the script runtime can usually be significantly shortened.
Example entry in the blacklist: tl_log, tl_search, tl_search_index, tl_session, tl_undo, tl_version
Data tables in the website template
A website template usually contains only content from the database tables that start with tl_. If you want to back up additional tables, enter the first letters of the tables here.
Example of Core and MetaModels tables: tl_, mm_
Alternative path for website templates
The website template files are usually created in the templates directory because the install tool also expects these files there. If you want to save the files to a different directory, specify the path here.
Files:
- .sql Template file to import
- .txt Text file with a short manual
- .structure File with the database structure
Compress backup with restore informations
The manual backup by download and the AutoBackup by cron job can be compressed. As a ZIP archive is created, additional important information for a restore can be added:
- Database backup
- composer.json
- composer.lock
- localconfig.php
- .env
- .env.local
- restoreSymlinks.php
The database backup with the additional information together with a saved FTP file backup should be sufficient to restore a running installation.
Number of backups at AutoBackupDB
AutoBackup does not overwrite old backups immediately. The backups are numbered, with the AutoBackupDB-1 file always containing the current backup. By default, the last 3 backups are saved. In this field, you can specify the number of backups.
E-mail notification after AutoBackupAppend AutoBackup file
The AutoBackup sends a mail to the system administrator (see settings) after successful backup, this mail can contain the backup file as an attachment. If the backup is compressed, the ZIP contains additional restore information (see above).
Restore symlinks
With a compressed backup you can restore the symlinks. To do this, save the file restoreSymlinks.php to the web directory of your Contao and call the file as follows: http://www.myDomain.tld/restoreSymlinks.php
Softleister - 2024-05-20
Thanks to BugBuster for assisting in transferring the extension from Contao 3 to Contao 4