Add occ command to expire the trashbin#25878
Conversation
|
@DeepDiver1975, thanks for your PR! By analyzing the annotation information on this pull request, we identified @schiessle and @LukasReschke to be potential reviewers |
|
Great !
|
| $maxAge = $this->expiration->getMaxAgeAsTimestamp(); | ||
| if (!$maxAge) { | ||
| $output->writeln("No expiry configured."); | ||
| // return; |
|
@DeepDiver1975 what's there to discuss ? I heard the primary reason for adding this would be to be able to run OCC commands from cron to ease the load from cron ? |
|
CC @cdamken |
a3d5c49 to
1c39261
Compare
|
Awesome!! Thanks Guys! @DeepDiver1975 I think this https://github.com/owncloud/enterprise/issues/1279 is would be fixed with this PR too |
|
@carlaschroder This should be added in the documentation ;) |
fore sure - once we agree on this ... |
|
@DeepDiver1975 how about the versions?, could be added too? |
on it .... |
I own you some beers ;) |
|
@mmattel thanks for your input - we can enhance this over time in follow up prs. |
|
Ok to me, |
1c39261 to
10fec5b
Compare
|
|
||
| $maxAge = $this->expiration->getMaxAgeAsTimestamp(); | ||
| if (!$maxAge) { | ||
| $output->writeln("No expiry configured."); |
There was a problem hiding this comment.
I'm getting this now. I thought we had defaults ? There was a thing about expiring trashbin items whenever the trashbin size reached 50% of the total available size
There was a problem hiding this comment.
Maybe it's new behavior, I can see that this command simply reflects the same behavior as the background job, so it's ok. Would be good to get some input from @VicDeo
There was a problem hiding this comment.
As far as I understood the code this whole expiry is purly based on time ... but I maybe I missed something in this mess .....
There was a problem hiding this comment.
@PVince81 as per #16300 that I documented in https://github.com/owncloud/core/blob/master/config/config.sample.php#L415 a value of
auto guarantees neither keeping nor deletion. Items might be deleted if a disk usage is over 50% of quota.
While exact values specify number of days to store / to delete after for min/max respectively.
From that point auto value means the mode before retention obligation was implemented. It is limited by quota usage for trashbin and by by number of copies per different time ranges for versions
There was a problem hiding this comment.
Anyway the best description was provided by @MTRichards in #16300 for Trashbin and #16301 for Versions.
This is actually a reference spec for retention
|
I tried setting "trashbin_retention_obligation" to "auto" but it still says it's unconfigured. A quick debug in the "Expiration" code shows that it keeps the max age to "no obligation". So it looks like the background job wouldn't expire the trashbin based on size even though the doc says it would when set to "auto". |
|
ok, looks like the size-based behavior is another single-shot expire job that gets scheduled only after a deletion. |
|
This is the other expire job for size: Looks like it would be too tricky to add this behavior into this command as well. Ok ok, I'll now test with numeric values. |
|
Tested, works 👍 (it was really painful to manipulate timestamps in oc_filecache as I forgot to also re-set the path_hash since the timestamp is also in the filename) |
|
Tested, works 👍 (it was really painful to manipulate timestamps in oc_filecache as I forgot to also re-set the path_hash since the timestamp is also in the filename) |
|
Ah, that was the trashbin stuff. Now testing versions, let me put the steps now:
|
|
@DeepDiver1975 fixed a bad copy-paste mistake to make version expire work: 3d618a1 |
|
Both trashbin expire and version expire work now 👍 |
|
can we make https://github.com/owncloud/core/blob/master/apps/files_trashbin/lib/BackgroundJob/ExpireTrash.php#L34 reuse the new commend? same with versions? otherwise we just duplicate code. |
|
👍 deduplicating would need further tweaking of the CommandJob. And increase complexity. |
yes - there are many similarities in the way we implement occ commands, bachgroundjobs and repairsteps. We should think about implementing on single interface which can be reused in all three areas. |
|
preparing backport ... |
* Add occ command to expire the trashbin * Fix versions folder in setup check
* Add occ command to expire the trashbin * Fix versions folder in setup check
|
Nice work! 👍 |
* Add occ command to expire the trashbin * Fix versions folder in setup check
…d20964cfd0f7129f998b1 [stable9.1] Add occ command to expire the trashbin (#25878)
…be58a2ac5542741378c25 [stable8.2] Add occ command to expire the trashbin (#25878)
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
@PVince81 @butonic