1. Please find attached script and copy to orion document root and verify the script syntax.
filepath : /opt/oriondev/cleanup_collected_contacts.php
# ll /opt/oriondev/cleanup_collected_contacts.php
-rw-r--r-- 1 root root 4401 Nov 20 11:06 cleanup_collected_contacts.php# php -ln cleanup_collected_contacts.php
No syntax errors detected in cleanup_collected_contacts.php
Please find attached script and copy to the following path
filepath : /opt/net/lib/popdb.ini
# ll /opt/net/lib/popdb.ini -rw-r--r-- 1 root root 112 Nov 26 12:29 /opt/net/lib/popdb.ini
2. Login to cloudmail db server and alter the au_contacts_cards table.
Note : If the table contains a large number of records, consider taking a backup and scheduling downtime before performing the ALTER TABLE operation.
MariaDB [(none)]> use aurora977;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [aurora977]> ALTER TABLE au_contacts_cards ADD COLUMN LastUsed DATETIME NULL DEFAULT NULL, ADD INDEX idx_addressbook_lastused (AddressBookId, LastUsed);
3. Take the Backup of the file original file and do vimdiff with attached file(contact_module.php)
# backupfile /opt/oriondev/modules/Contacts/Module.phpfind comment (netcore changes to remove collected address [START] / netcore changes to remove collected address [END]) added in attached script and add that changes only.
# vimdiff /root/contact_module.php /opt/oriondev/modules/Contacts/Module.php4. Execution of the script.
Usage:
1. Help:
php /opt/oriondev/cleanup_collected_contacts.php --help
2. Single domain - Dry run:
php /opt/oriondev/cleanup_collected_contacts.php --days=60 - domain=example.com --dry-run
3. Single domain - Actual deletion:
php /opt/oriondev/cleanup_collected_contacts.php --days=60 --domain=example.com
4. All active domains - Dry run:
php /opt/oriondev/cleanup_collected_contacts.php --days=60 --dry-run
5. All active domains - Actual deletion:
php /opt/oriondev/cleanup_collected_contacts.php --days=60
5. cron set up
0 00 * * * /usr/bin/php /opt/oriondev/cleanup_collected_contacts.php --days=60 >> /var/log/collected_contacts_cleanup_`date +\%F`.log 2>&1
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article