Search by

jovibarba / contao-backup-bundle

jovibarba

Full backup and restore (database, files, templates, configuration) for Contao 5 via console commands. Pure PHP, no mysqldump or tar required.

Package info

github.com/jovibarba/contao-backup-bundle

Type:contao-bundle

pkg:composer/jovibarba/contao-backup-bundle

Statistics

Installs: 5

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.1 2026-09-13 11:10 UTC

This package is auto-updated.

Last update: 2026-09-13 11:12:05 UTC


README

Vollständiges Backup und Restore für Contao 5 (Datenbank, Konfiguration, Templates/Code, files/) als Konsolenbefehle und Backend-Modul. Reines PHP, braucht weder mysqldump noch tar und läuft damit auch auf Shared Hosting.

Installation

Über den Contao Manager (Paket jovibarba/contao-backup-bundle suchen) oder per Composer:

composer require jovibarba/contao-backup-bundle

Befehle

Die Befehle heißen bewusst contao:full-backup:*, damit Contaos eigene Datenbank-Befehle contao:backup:* (die auch der Contao Manager nutzt) unangetastet bleiben.

php vendor/bin/contao-console contao:full-backup:create [--no-files] [--no-templates] [--no-config] [--no-prune]
php vendor/bin/contao-console contao:full-backup:list [--all]
php vendor/bin/contao-console contao:full-backup:restore [<name>] [--db] [--templates] [--files] [--config] [--yes]

Ohne Optionen fragt contao:full-backup:restore interaktiv nach Backup, Bestandteilen und einer JA-Bestätigung. Vor einem Datenbank-Restore wird die aktuelle Datenbank automatisch als _vor-restore-<zeit> gesichert, während des Restores ist die Seite im Wartungsmodus.

Backend

Menüpunkt System → Backup (nur Administratoren): Backup anlegen, Liste mit Manifest und Download pro Datei, Restore mit Auswahl und JA-Bestätigung, Löschen. Der Restore läuft dort in einem Web-Request, bei sehr großen files/-Ordnern ist der Konsolenbefehl der sicherere Weg.

Konfiguration (config/config.yaml)

contao_backup:
    directory: '%kernel.project_dir%/var/backups/full'   # Standard
    keep: 5                # pro Art (normal / vor-Restore), 0 = alles behalten
    include:
        files: true        # files/
        templates: true    # templates/, contao/, packages/
        config: true       # composer.json, composer.lock, .env, .env.local, config/

Aufbau eines Backups

var/backups/full/2026-09-13_11-26-06/
├── datenbank.sql.gz     Contao-eigenes Dump-Format (SET FOREIGN_KEY_CHECKS, DROP/CREATE, INSERT)
├── konfiguration.zip
├── templates.zip
├── files.zip
└── manifest.txt

Hinweis: templates.zip enthält packages/. Ein Restore aus einem älteren Backup setzt damit auch lokale Path-Repository-Pakete zurück.