—- plugin —-
description: A plugin to delete old records from the phplist database.
author : Duncan Cameron
lastupdate : 2017-09-17
compatible : phplist 3
This plugin deletes old and unused records from various tables, either single tables or a group of related tables.
The plugin provides a page that can be invoked through menu System > Housekeeping or as a cron job.
Rows will be deleted from the message table that have a status of 'sent' and whose sent date is earlier than the current date less the configuration threshold value.
Rows will also be deleted from all tables related to the message table, these are
Rows will be deleted from the eventlog table whose date field is earlier than the current date less the configuration threshold value.
Rows will be deleted from the bounces table whose date field is earlier than the current date less the configuration threshold value.
Rows will be deleted from the usermessagebounce table whose time field is earlier than the current date less the configuration threshold value.
Rows will also be deleted from the bounceregex_bounce table that refer to bounces which no longer exist.
Rows will be deleted from the linktrackforward table that are no longer used (do not have a reference in either the linktrackml or linktrackumlclick tables).
This can happen after deleting campaigns,and a row in linktrack_forward is no longer used by any campaigns.
Deletes rows from the userhistory table that are older than the threshold, but taken from each subscriber's most recent userhistory record. This ensures that the user history for a subscriber will never be totally deleted.
For example, if the threshold is 6 months and the most recent user_history record for a subscriber was 2 months ago, then the records for that subscriber older than 8 months will be deleted.
See the README file on the GitHub page https://github.com/bramley/phplist-plugin-housekeeping for how to install.
The text displayed by the plugin can be translated into other languages. See the file plugins/HousekeepingPlugin/lan/translations_en.php for the English version that can be used as the basis for another language. Each line in the file contains the English text then the equivalent text in the target language.
To create a new language file, copy translationsen.php to translationsxx.php, where xx is the language code, then change the texts for your target language. You can share your new language file by submitting it for inclusion in the plugin. Please create a topic in the user forum or an issue on GitHub.
The plugin provdes a section on the Settings page where you can configure which tables should be processed.
The threshold values must be specified as a number of days, weeks, months, quarters or years, for example
The housekeeping can be automated by running a cron job periodically, say each week or month. The cron command should be similar to this but adjusted for the command to run php and the installation directory of phplist:
php /home/xxx/public_html/lists/admin/index.php -p process -m HousekeepingPlugin -c /home/xxx/public_html/lists/config/config.php