Edit | Tags | Source | Print

Posted 1254887290|%O ago by leigerleiger
Auto-numbering categories is useful. Auto-renaming is just as useful. Intrigued? Read on.

The request

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.

Further explanation

For example:

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.

  1. Admin clicks on "add category"
  2. Select category name from list and it's added to the list of pages that have auto-renaming enabled
  3. Admin sets time period for rename to occur (e.g. 3 days)
  4. Admin sets the prefix and suffix for the rename (e.g. prefix is deleted:, no suffix)

Prefixes, Suffixes

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.

UI mock-up



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.

Add a New Comment