PrestaShop Module: Tec Datacleaning - Safe cleaning of database statistics
Tec Datacleaning is a module for PrestaShop 1.7+ designed to securely and programmatically manage the cleaning of database tables that contain statistical data about your e-commerce business, such as connections, page views, guest visitor records, 404 pages, internal searches, and other metrics.
Goal of the module
Over time, statistical tables such as connections, connections_page, guest or statssearch can grow tremendously, slowing down database maintenance operations and affecting overall performance. Tec Datacleaning provides reliable tools to remove obsolete or unnecessary data without risking database integrity.
Key features
- Support for automatic cron - allows periodic cleanups to be scheduled via cron endpoint authenticated using a secure key.
- "Fast Cleanup" mode with TRUNCATE - fast cleanup option that empties selected statistical tables entirely when allowed by database permissions.
- Secure Fallback with batch DELETE - if the TRUNCATE operation is not possible (e.g., due to foreign key constraints or permissions), the module performs configurable batch deletions to avoid blockages.
- "Dry run "preview mode - allows to see how many rows would be deleted without actually performing the operation, useful to avoid accidental deletions.
- Configuration interface in the Back Office - selection of tables to be cleaned, setting of retention months, definition of batch size and display of secure key.
Secure operation management
The module clearly highlights that TRUNCATE and DELETE are destructive operations. Before performing them, it is recommended to:
- perform a dry run to view the affected data;
- perform a full backup of the database.
These precautions are essential to maintain data integrity and prevent accidental deletions. :contentReference[oaicite:6]{index=6}
Configuration in the Back Office
The configuration section allows you to:
- view or set the secure key for the cron endpoint;
- select which statistical tables to include in cleanup operations;
- define how many months of data to retain before deletion;
- configure the batch size for DELETE deletions in case of fallback.
Using the Cron Endpoint
The module exposes a cron endpoint accessible via URL authenticated by the secure key:
https:///module/tec_datacleaning/cron?secure_key=
This allows statistics cleanup to be integrated within external scripts or automation services.
Technical Requirements
- PrestaShop version 1.7 or higher (also compatible with PrestaShop 8/9).
- Appropriate permissions for
DELETEoperations in the database. - High permissions for
TRUNCATEoperations, often blocked by constraints or restrictions.
Usage tips
To ensure efficient and safe cleanups:
- launch the module in "dry run" mode before final actions;
- schedule cleanups at low traffic times;
- restrict access to the cron endpoint, for example by IP whitelisting.
Conclusion
Tec Datacleaning is an effective tool for keeping your PrestaShop store's statistical data archive optimized and under control. It offers secure and flexible automation options for periodic cleaning, with intelligent fallbacks for database-constrained environments.