Versions on external storage never expire #24161

PVince81 opened this Issue Apr 21, 2016 · 3 comments


None yet

1 participant



  1. Mount an external storage (ex: SMB) as "/smb" system-wide, apply to all users
  2. Login as any user
  3. Create a file "/smb/test.txt"
  4. Edit the file and save many times to create 10-20 versions
  5. Check the version files for that user: find data/user1 -iname \*.v\*
  6. update oc_jobs set last_run=0
  7. Run cron.php

Expected result

Some version expired

Actual result

No versions expired.


ownCloud 9.0.1

The reason is because the expire() method calls getUidAndFilename and the external storage has no owner, so it bails out with NoUserException without doing any expiration.

According to @schiesbn, versions on system-wide ext storage are always specific to the current user viewing the folder. So the correct logic would be to make it fallback to the user that was specified in the expire job.

CC @nickvergessen @VicDeo

@PVince81 PVince81 added this to the 9.0.3-next-maintenance milestone Apr 21, 2016

Looks like the code in getUidAndFilename is very old, it assumes that the owner can be another user. This is obsolete because since the introduction of expire background jobs, we only ever expire for the user specified in the expire job. For shared folders, the expire job is only created for owners even when a recipient edited a file.

This means that as part of this fix we can get rid of getOwner() and always use the expire job user.
It would also fix the case with external storage where we need to use that user too.

@PVince81 PVince81 added the sev2-high label Apr 25, 2016
@PVince81 PVince81 modified the milestone: 9.0.5, 9.0.4 Jul 18, 2016

@VicDeo can you take care of this ?

@PVince81 PVince81 modified the milestone: 9.0.6, 9.0.5 Aug 18, 2016
@PVince81 PVince81 modified the milestone: 9.0.7, 9.0.6 Oct 20, 2016
@PVince81 PVince81 referenced this issue Nov 10, 2016

Properly expire ext storage versions #26601

8 of 14 tasks complete

Fix is here #26601

@PVince81 PVince81 closed this in #26601 Nov 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment