Page MenuHomePhabricator

Provide an option that if enabled, will only consider archiving threads when they are closed.
Open, Needs TriagePublicFeature


In Armenian Wikipedia, on the Articles for Deletion page (and more, this is just an example), discussions are considered finished when a user (usually an admin) closes it by adding a {{ՔՓ}} template at the top of the page with a result (example). Per the policy, we shouldn't archive any thread until it is closed with either delete or keep decision. Currently, there is no way to force to respect this policy

Add a new option called archive_only_if_present = TEMPLATENAME (maybe a regex?), something like this

|archive = Վիքիպեդիա:Ջնջման առաջադրված հոդվածներ/%(monthname)s, %(year)d
|algo = old(1w)
|counter = 1
|minthreadstoarchive = 1
|archive_only_if_present = ԹՓ
|minthreadsleft = 0
|archiveheader = {{ՋԵՀ արխիվ|%(month)d|%(year)d}}

and if the option is present, the bot only will archive threads that contain the given string/regex/template. If it is missing, the bot will behave as before.

I think it would be quite straightforward to implement this. We just need a simple if check in the PageArchiver.should_archive_thread method.

def should_archive_thread(self, thread: DiscussionThread
                          ) -> tuple[str, str] | None:
    archive_only_if_present = self.get_attr('archive_only_if_present')
    if archive_only_if_present and not'\{\{ *' + archive_only_if_present + ' *\|', thread.content):
        return None
    # Archived by timestamp
    algo = self.get_attr('algo')