Shop Cleaner

How to free up space in PrestaShop: clean cache, orphan images and the database safely

Over the years PrestaShop piles up caches, images of products that no longer exist, forgotten backups and millions of statistics rows. Here is what can be deleted, what can't, how to do it safely, and how Shop Cleaner measures and cleans it with a quarantine you can restore.

The problem: PrestaShop never throws anything away

A shop that is a few years old often takes several times the space it needs. PrestaShop doesn't delete what it stops using:

  • Caches compiled by Smarty and var/cache folders from other environments.
  • Thumbnails of image types you deleted, and images of products, categories or brands that no longer exist.
  • Backups from the back office and the upgrade module.
  • Statistics on visits, connections and searches going back years: millions of rows.
  • Abandoned carts, guests without orders, old logs and mail logs.

All of that raises hosting costs, slows backups and complicates upgrades and migrations. And keeping personal data for no reason clashes with GDPR data minimisation.

The solution: measure, split by risk and clean with a safety net

1. Take a full backup first

Files and database. That is rule number one before any clean-up.

2. Measure before touching

Find out which folders and tables take the most. Over SSH, du -sh on the img, var and cache folders; in the database, table sizes from information_schema. The usual suspects are ps_connections, ps_guest, ps_pagenotfound, ps_cart and ps_log.

3. Tell apart what regenerates from what doesn't

  • Regenerates: caches, temporary files and combined CSS/JS. Safe to delete; PrestaShop rebuilds them.
  • Doesn't regenerate: images, backups, modules, customers and products. Before deleting, make sure they really are unused and that you can get them back.

4. Delete records the PrestaShop way

A direct DELETE on the customer or product table leaves related tables orphaned and doesn't notify other modules. If you delete records, do it through PrestaShop.

5. Optimise tables and repeat regularly

After deleting many rows, optimising the tables gives disk space back. And clean-up should be repeated: the clutter comes back.

All of this can be done by hand over FTP and SQL, but one wrong file is enough to break the shop.

How Shop Cleaner helps

Shop Cleaner is our module for PrestaShop 1.6.1 to 9.2 (PHP 7.1 to 8.5) that measures everything, shows you where the space goes and cleans it when you decide:

NeedWhat the module does
MeasureA read-only analysis and a dashboard with charts: recoverable space, disk per folder, largest tables and space recovered month by month.
FilesStale caches, temporary files, logs, thumbnails of deleted types, orphan images and old backups.
DatabaseOld statistics, not-found pages and searches, abandoned carts, anonymous guests, logs and table optimisation.
Records and modulesCustomers without orders, disabled products, expired cart rules and specific prices by your own deadlines, deleted the PrestaShop way; folders of uninstalled modules.
SafetyAnything that can't regenerate goes through a quarantine that restores each file and row in place (purged after 30 days, configurable). Nothing is cleaned without your confirmation.
Large shopsClean-ups run in batches of about 20 seconds, without hitting server time limits.
Follow-upOptional weekly cron that analyses and purges expired quarantine, a back-office notice and a history of what was cleaned.

Install, analyse and decide: each category tells you what it cleans, its risk and how much it frees.