User:Hazard-Bot/Archiver
- Note: This page details how you can customize how automated archiving is handled. You can, however place
{{subst:User:-revi/Autoarchive setup}}
at the top of your talk page for fast setup, or just modify one of the examples and use it.
Both Hazard-Bot and Revibot I examine backlinks to {{User:Hazard-Bot/Archiver}}
and archive old discussions on those pages. This is done by breaking a page into threads, then scanning each thread for timestamps. Threads older than a specified threshold are then moved to another page (the archive), which can be named either basing on the thread's name or the name can contain a counter which will be incremented when the archive reaches a certain size.
Format
Transcluded template may contain the following parameters:
{{User:Hazard-Bot/Archiver | archive = | algo = | counter = | maxarchivesize = | minthreadsleft = | minthreadstoarchive = | archiveheader = }}
Parameters
Meanings of parameters are:
Parameter | Description |
---|---|
archive | The name of the page to which archived threads will be put. Must be a subpage of the current page. Variables are supported. |
algo | The delay after the most recent comment on each thread before the thread may be archived. It must be if the form old(<delay>) where <delay> specifies the delay, and must be given in hours or days, for example, 24h, 72h, 5d, 21d. The default value is old(24h). |
counter | The current value of the counter which could be assigned as a variable. This will be ignored if not used, or will be initialized to 1 if needed. The bot will update this parameter as necessary. |
maxarchivesize | The maximum archive size before incrementing counter. This is ignored if counter is not used. The values used must be in a #B, #K, #M, or #T format (using a capital letter) to represent the number of bytes, kilobytes, megabytes, or terabytes respectively, for example: maxarchivesize=256K meaning 256 kilobytes. The default value is 1000M. |
minthreadsleft | The minimum number of threads that should be left on a page (to prevent the pages from getting completely harvested). The default value is 5. |
minthreadstoarchive | The minimum number of threads to archive at once. The default value is 2. |
archiveheader | Content that will be put on new archive pages as the header. This parameter supports the use of variables. The value of this parameter cannot be multiline! You may use a template in order to add significant content. The default value is {{Talkarchive}} .
|
Variables
Variables below can be used in the value for "archive" in the template above:
Variable parameter | Expands to... |
---|---|
%(counter)d | the current value of the counter |
%(year)d | year of the thread being archived |
%(isoyear)d | ISO year of the thread being archived |
%(quarter)d | quarter of the year of the thread being archived |
%(month)d | month (as a number 1-12) of the thread being archived |
%(monthname)s | English name of the month above |
%(monthnameshort)s | first three letters of the name above |
%(week)d | week number of the thread being archived |
%(isoweek)d | ISO week number of the thread being archived |
The ISO calendar starts with the Monday of the week which has at least four days in the new Gregorian calendar. If January 1st is between Monday and Thursday (inclusive), the first week of that year started the Monday of that week, which is in the year before if January 1st is not a Monday. If it's between Friday and Sunday (inclusive) the following week is then the first week of the year. So up to three days are still counted as the year before.
Examples
Static archive
This example will archive all threads which have been inactive for at least 7 days from User talk:Example to User talk:Example/Archive.
{{User:Hazard-Bot/Archiver | algo = old(7d) | archive = User talk:Example/Archive }}
Incremental archive
This example will archive all threads which have been inactive for at least 31 days from User talk:Example to User talk:Example/Archive 1, provided that at least 4 threads are left on the page. Just before that archive has 70 kilobytes, the counter will be changed to 2, and threads will be then archive to User talk:Example/Archive 2, and so on, each new archive being created with the header {{Archive}}
.
{{User:Hazard-Bot/Archiver | algo = old(31d) | archive = User talk:Example/Archive %(counter)d | counter = 1 | maxarchivesize = 70K | archiveheader = {{Archive}} | minthreadstoarchive = 1 | minthreadsleft = 4 }}
Date-based archives
This example will archive all threads which have been inactive for at least 5 days from User talk:Example to User talk:Example/Archives/2024/December. As the month and year change, the archive page will change accordingly, and each new archive will be created with the header {{MonthlyArchive}}
.
{{User:Hazard-Bot/Archiver | algo = old(5d) | archive = User talk:Example/Archives/%(year)d/%(monthname)s | archiveheader = {{MonthlyArchive}} }}
The above documentation is transcluded from User:Hazard-Bot/Archiving (edit | history). Editors can experiment in this template's sandbox (create | mirror) and testcases (create) page. Subpages of this page. |