richardhj/contao-privacy-dump

Create anonymized dumps of the Contao database.

Installs: 1 543

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 3

Forks: 1

Open Issues: 1

Type:contao-bundle

dev-main 2021-12-01 14:09 UTC

This package is auto-updated.

Last update: 2024-10-29 06:24:58 UTC


README

A Contao plugin to create a purged and anonymized database dump

About

This Symfony bundle provides utilities for creating anonymized database dumps.

It is the equivalent of mysqldump, with additional features, at the cost of performance (PHP implementation). The main purpose of this tool is to create anonymized dumps, in order to comply with GDPR regulations.

Features

  • Data converters (transform the data before it is dumped to the file)
  • Table filtering
  • Tables include list (only these tables will be included in the dump)
  • Tables exclude list (not included in the dump)

Installation

composer require richardhj/contao-privacy-dump

Usage

php vendor/bin/contao-console privacy-dump contao contao --filename dump.sql

Importing the anonymized dump

In combination with richardhj/contao-backup-manager:

  1. Create anonymized dump on the remote system.
  2. Download the anonymized dump (with scp) and place the file in /backups.
  3. Import the purged database dump on your local machine.
php vendor/bin/contao-console backup-manager:restore contao local dump.sql

This workflow can be represented in a Deployer recipe, see these recipes.

Make sure to call the restore command in the correct instance!

Configuration

The plugin is pre-configured to purge personal data in tl_member, tl_opt_in and the like.

You can override and extend the configuration:

richardhj_privacy_dump:
  config:
    contao:
      tables:
        tl_my_custom_table:
          truncate: true

        tl_iso_address:
          converters:
            firstname:
              converter: 'anonymizeText'
            lastname:
              converter: 'anonymizeText'
            street:
              converter: 'anonymizeText'
            company:
              converter: 'anonymizeText'
            email:
              converter: 'randomizeEmail'
              cache_key: 'member_email'
              unique: true
            username:
              converter: 'randomizeEmail'
              cache_key: 'member_email'
              unique: true