User:Archivist

From RationalWiki
Jump to navigation Jump to search

How to archive[edit]

Copy-pasta[edit]

Copy-paste this at the top of a talkpage:

{{Talkpage/Pibot
|algo=old(30d)
|archive={{subst:NAMESPACE}}:{{subst:PAGENAME}}/Archive%(counter)d
|maxarchivesize=100K
|search=yes
}}

This will archive sections that have been inactive for 30 days. Change "30d" for other times; "24h" for 24 hours, "60d" for 60 days, etc.

Prevent archiving[edit]

The easiest way is to add (sticky) at the end of a section title. EG:

== Hi there (sticky) ==

You can also add a fake timestamp to a section. EG, the below prevents the bot from archiving until the 1st of December 2017 plus whatever you set |algo to:

<!-- Prevent Archive 21:09, 1 December 2017 (UTC) -->

Bot info[edit]

Command-line[edit]

At 0200 UTC every day, this script runs:

pwb.py archivebot.py Talkpage/PibotHidden 2>&1 -all -v -log
pwb.py archivebot.py Talkpage/Pibot 2>&1 -all -v -log

archivebot.py[edit]

To respect sticky threads, archivebot.py is edited:

Standard:
    def should_be_archived(self, archiver):
        algo = archiver.get_attr('algo')
        re_t = re.search(r'^old\((.*)\)$', algo)
		
        if re_t:
            if not self.timestamp:
                return ''
            # TODO: handle this:
            # return 'unsigned'
            maxage = str2time(re_t.group(1))
            if self.now - self.timestamp > maxage:
                duration = str2localized_duration(archiver.site, re_t.group(1))
                return i18n.twtranslate(self.code,
                                        'archivebot-older-than',
                                        {'duration': duration})
        return ''
Edit:
    def should_be_archived(self, archiver):
        algo = archiver.get_attr('algo')
        re_t = re.search(r'^old\((.*)\)$', algo)
		
        if re_t:
            if not self.timestamp:
                return ''
            if self.title.lower().endswith('(sticky)') or self.title.lower().startswith('(sticky)'):
                return ''
            # TODO: handle this:
            # return 'unsigned'
            maxage = str2time(re_t.group(1))
            if self.now - self.timestamp > maxage:
                duration = str2localized_duration(archiver.site, re_t.group(1))
                return i18n.twtranslate(self.code,
                                        'archivebot-older-than',
                                        {'duration': duration})
        return ''


Recent edits[edit]

See Special:Contributions/Archivist for a full list.