Open skttl opened 4 years ago
Hey @skttl - would you still be interested in a PR for this? It seems a great idea and not too complicated, so I'd love to have a go at it :-) On first glance I might have a question or two regarding configuration, though. How do we best allow X to be set without breaking the current config setup, etc.
Hi @jannikanker
I would love a PR for this 👍
My inital thought on the config, was to add a type attribute with a default value of version
. By setting this to trash
in stead, it would instruct UnVersion to remove matching nodes in the trash.
<add type="trash" docTypeAlias="newsPage" rootXpath="//newsIndex" maxDays="2" maxCount="10" />
I'm not sure if rootXPath is going to be useable in this scenario though :)
For the scheduling, I was thinking of seeing if it was possible to extend Umbracos own scheduled publishing to take care of this too. Maybe it fires an event or something similar.
@skttl Cool! I'll give it a go then...
Regarding config it looks a bit like what I was thinking, but I was worried if it's a bit too "dirty" to mix two "functionalities" into the same config system :-) Adding a type makes excellent sense, though. As you say, it might get interesting if it needs to support specific doctypes, but we'll see :-D
I was thinking about setting up some RecurringTaskBase stuff for scheduling - I'll be sure to first take a look at what already exists with scheduled publishing.
@skttl I've made a draft PR for now. I'd like to fix encoding/line endings weirdness as well as - of course - discuss the consequences of my changes :-)
So instead of pruning old versions, you prune the recycle bin for nodes trashed more than X days ago, or so you'll only have X amount of nodes in your recycle bin.
This should probably run on startup, or as a scheduled task.