civicrm-cleaner is a CLI tool to help clean CiviCRM contact databases.
This project is under AGPL-v3 license.
Project maintainer: John Livingston.
Clone or download the repository in a subfolder of your CiviCRM directory.
TODO: where exactly?
Install production dependencies:
composer install --no-dev
Note: avoid running it as root.
./bin/cli.php --help
./bin/cli.php contact_trash --run rollback -v --max 2 /tmp/result.csv
# Note: the script will append the current result to the output file.
# You can add current date to prevent mixing execution results:
./bin/cli.php contact_trash --run rollback -v --max 2 /tmp/result.$(date '+%Y-%m-%d.%H.%M.%S').csv
Note: avoid running it as root. Add something like sudo -u www-data
on front of these commands if you are connected as root.
For a full list of commands, options and arguments, use --help
.
Note: avoid using ctrl+c to stop the script. It could result in an incomplete output file.
Install dev dependencies:
composer install
To lint the code:
./vendor/bin/phpcs --standard=vendor/drupal/coder/coder_sniffer/Drupal bin/
This script is compatible with Campagnodon. It will auto-detect if you are using it.