If, for some reason (for instance in result of script execution failure due to EZP-21840), cleanup old versions of content does not run for sometime, one can end up in a scenario where there are more old versions that the legacy cleanupversions script can handle.
- create an image object
- edit and publish this object many times (say 1000, use the command below if needed)
- setup [VersionManagement] DefaultVersionHistoryLimit=10
- execute php ezpublish/console ezpublish:legacy:script bin/php/cleanupversions.php
=> the script will take too long to execute and fail due to database timeout