Posted 1254887290|%O ago by leiger
Auto-numbering categories is useful. Auto-renaming is just as useful. Intrigued? Read on.
A future project that I plan to work on requires that pages in a certain category be deleted after a certain period of time. For example, once a page in the "claim" category is 3 days old, it is soft-deleted (exception is for pages starting with an underscore, eg, the live template)
This could be done manually by using ListPages — listing all pages in the category alongside their creation dates — and deleting anything that has passed it's use-by date, but this is inefficient and I'm hoping it can be done automatically.
|Date||Name of page created|
|1/10 12:00||Page 144-235 created|
|1/10 13:00||Page 325-235 created|
|2/10 12:00||Page 345-235 created|
|3/10 14:30||Page 144-235 attempted, but page already exists|
|4/10 12:00||Page 144-235 auto-renamed to deleted:144-235|
|4/10 14:30||Page 144-235 attempted, no such page, creation is successful|
So, at approximately 12:00 on the 4th of October, that page is automatically renamed from claim:144-235 to be deleted:claim:144-235, meaning that a new claim:144-235 can be created.
This would be a Site Manager setting, similar to how autonumbering is set up currently.
In this case:
Prefix is prefix|
Suffix is |suffix
Auto-numbering should also be supported by the prefix/suffix if possible. That would mean that a page called claim:144-235 is renamed to deleted:claim:144-235:1, then the next time a page of that name is auto-deleted it is renamed to deleted:claim:144-235:2, and so on.
If auto-numbering is disabled, then the previous deleted:claim:144-235 would be overwritten by the new one.
Due to it being customisable (i.e. length of time, prefix and suffix), I'm sure it could be used in a range of circumstances.