Triggering versions retetion obligation

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 31.0.6
  • Operating system and version (e.g., Ubuntu 24.04):
    • true nas scale
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • Docker

Summary of the issue you are facing:

Hello,

When I first set up Nextcloud, my users had unlimited quotas and versioning was left at the default setting: "auto". I quickly ran out of space, so I set quotas for everyone and added the following line to config.php:

'versions_retention_obligation' => 'auto,3',

However, even after many days, I still see old versions in the versions folders, so it seems this setting did not take effect. Do I need to trigger something manually if the folders were created before this change in config.php?
I don’t want to delete all version files for particular users, only those older than 3 days, as specified in the config.

1 Like

Yes, to enforce the versions_retention_obligation setting, you need to trigger the cleanup manually. You can do this by running the following OCC command inside your Docker container:

sudo -u www-data php occ versions:cleanup

In Docker, it might look like:

docker exec -u www-data <container_name> php occ versions:cleanup

This will apply your new retention rules (auto,3) and remove versions older than 3 days. The automatic cleanup runs periodically, but it can take time, so manual triggering is often needed after config changes.

Is this chat gpt answer? Cuz this is wrong and it gave me the same wrong answer… this occ command doesnt apply retention policy and just deletes every version. Snapshot everything before using ChatGPT… (fortunately I’ve had and will be more cautious with chat)