Jump to content

[Module] Tidy - database clean up and optimization, data consistency fix


Recommended Posts

Prestashop Tidy module will help you keep your store fast and clean. I've noticed that cleaning up millions of old stat rows can improve the performance and increase stability of prestashop.

The module allows you to perform the following operations:


  • delete old abandoned carts
  • delete old connections stats
  • delete old search stats
  • delete old email logs
  • delete old logs
  • delete old guests with no addresses
  • delete old customers with no addresses (useful if your shop suffered from bots registering fake accounts)
  • delete expired specific prices from products
  • delete expired vouchers
  • clear all cache

You can set number of days to only delete data older than this setting (but not for cache, it gets cleared totally).

Data consistency

  • regenerate friendly URL’s for products (for all languages)
  • regenerate friendly URL’s for categories
  • set product's cheapest combination as default

Fix images

  • delete products’ broken images (the ones that appear as question marks)
  • delete unused image files (cleans all leftovers in the img/p/ folder along with empty folders)
  • set first image as cover for products without cover
  • set product’s cover as it’s first image
  • delete temporary images

Fix associations

  • set product’s deepest category as default
  • assign all products to parent categories (usefull if some products are assigned only to some deep categories, but you want them to appear also in parent categories)
  • assign all customer groups to all categories

Mass activation and deactivation

  • deactivate active categories without active products
  • deactivate active products not assigned to any active categories
  • activate inactive categories with active products
  • deactivate active manufacturers without active products
  • activate inactive manufacturers with active products

You can also automate each of the above operations with cron tasks, making your shop clean itself on a daily basis.

[Click here to speed up and clean your shop - module's page on CodeCanyon]

Edited by Daresh (see edit history)
  • Like 1
  • Thanks 2
Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

Hi, I read that it has implemented the ability to delete images that remained after the cancellation of the products in the famous img / p / folder. We realized that in the famous folder there are hundreds of unused empty numbered folders 0-9 which however increase the number of files / folders writing with the consequent increase in the use of inodes. Does your form also delete these folders in addition to the images left by mistake? Thank you.
(sorry for any errors but it has been translated by software)

Link to comment
Share on other sites


I assure you that this is a big problem, since infinite folders are created, like Chinese boxes that increase the number of inodes even after a total cancellation of products (as in our case, to start from scratch). If he does this update he will surely have a response in higher sales (we among the first). Anyway, thank you for your quick reply.

Link to comment
Share on other sites

And there you have it - I just updated the Tidy module to remove empty folders after it finished removing unused images.

So it should also remove empty folders even when there are no unused images, that's probably your case.

Link to comment
Share on other sites

Hello, the Prestashop version is and your submitted form is 1.3.8. I also noticed that some unused photos that nestle in folders have not been deleted. I have some screenshots to send you. As you can see the famous folders 1,2,3, eccc which are 99% empty have not been deleted and in none of them (image 2) there are photos not deleted.



Link to comment
Share on other sites

By empty folders, I mean those numbered from 1 to 9, which internally have folders from 1 to nine and so on. It seems to me that these folders are created when I enter products and contain images, which are then not deleted with the deletion of the products themselves. Writing these folders and files makes me increase the number of inodes, which should decrease with their deletion, I think. There are no problems to analyze everything, tell me everything you need in the private email: [email protected]

Link to comment
Share on other sites

  • 10 months later...

Hello ,

I have bought the module especially to clean up images.

Unfortunately there are issues with it :

- on calling "delete unused images" from button I get the error :

"Error: Maximum execution time of 30 seconds exceeded"

- on calling from cron url I get

Notice: Undefined offset: 1 in /home/asdasd/public_html/modules/gmtidy/gmtidy.php on line 596

Fatal error: Maximum execution time of 30 seconds exceeded in /home/asdasd/public_html/modules/gmtidy/gmtidy.php on line 558


if I try to call delete temporary files I get :

Warning on line 419 in file /home/asdasd/public_html/modules/gmtidy/gmtidy.php
[2] unlink(/home/asdasd/public_html/img/tmp//mp_temp_dir): Is a directory


thank you,


Link to comment
Share on other sites

30 seconds is a very low script execution limit for a task like this.

Ask your admin to either increase this limit, launch the script by a CRON task (often has higher or no execution limits).

Also refer to the documentation, because the module is able to view only part of the img/p tree, for example you can only make it look for unused images in img/p/1 and all subfolders. And then img/p/2 and so on. Some customers even start deeper like img/p/1/1 img/p/1/2...

Link to comment
Share on other sites

Sometimes the server admin is able to launch the script not by an URL but by it's path on the server and have less limits, but it all depends if your server gives you SSH access.

Try to limit the tree the module is trying to view by adding a parameter to the URL: &sub=1 or any other subtree of the img/p folder.

If still not enough time, try with &sub=1/1 or even &sub=1/1/1

Link to comment
Share on other sites

  • 3 months later...
  • 4 months later...

Dear Daresh

I just purchased your module. Is it possible to improve it so that the data that is deleted, can be displayed before cleanup? For example I cannot see wich customers will be deleted if I click on those withouth adress....

Also is there any way to cleanup newsletter registration? I have a lot of spam there that I would avoid to send any newsletter out

Link to comment
Share on other sites

  • 4 months later...
On 1/12/2022 at 7:33 AM, azurtem said:

thanks for your swift response

How does it determine whether a cart is in use or not ? e.g. my quote module adds a cart entry to store the products included in a quote



I use the Settings > Interval Days. I set this to 60 so when I clean the carts it only deletes carts older than 60 days. You could set it for however long your quotes are valid

Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...