Ashot1997 created this task.
Ashot1997 added a project: Pywikibot-archivebot.py.
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper.

TASK DESCRIPTION
  **Context**:
  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 
<https://hy.wikipedia.org/w/index.php?title=%D5%8E%D5%AB%D6%84%D5%AB%D5%BA%D5%A5%D5%A4%D5%AB%D5%A1:%D5%8B%D5%B6%D5%BB%D5%B4%D5%A1%D5%B6_%D5%A1%D5%BC%D5%A1%D5%BB%D5%A1%D5%A4%D6%80%D5%BE%D5%A1%D5%AE_%D5%B0%D5%B8%D5%A4%D5%BE%D5%A1%D5%AE%D5%B6%D5%A5%D6%80&diff=next&oldid=8956862>).
 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 archivebot.py to 
respect this policy
  
  **Proposal**:
  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 re.search(r'\{\{ *' + 
archive_only_if_present + ' *\|', thread.content):
            return None
        # Archived by timestamp
        algo = self.get_attr('algo')
        ............

TASK DETAIL
  https://phabricator.wikimedia.org/T356179

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Ashot1997
Cc: Aklapper, pywikibot-bugs-list, Ashot1997, MJL
_______________________________________________
pywikibot-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to