Last modified: 2014-09-02 01:29:00 UTC
Originally from: http://sourceforge.net/p/pywikipediabot/feature-requests/192/ Reported by: multichill Created on: 2009-05-01 12:51:59 Subject: Make commonscat.py use deletion summaries Assigned to: multichill Original description: If an category at Commons gets renamed and the original category gets deleted commonscat is not able to find the new category. Commonscat should have another function which checks the deletion summary for the new category name. This deletion summary can be pulled from the api, see for example: http://commons.wikimedia.org/w/api.php?action=query&list=logevents&leprop=comment&letype=delete&ledir=older&letitle=Category:Ports\_and\_harbours\_of\_Australia&lelimit=1 If a correct destination category is found, the bot should use this. This function should probably be last resort \(after checking the interwiki's for a possible link\).
Looks like this was implemented some time ago, but bug not closed. Relevant snipped: if not commonsPage.exists(): logpages = commonsSite.logpages(mode='delete', title=commonsPage.title()) try: logitem = logpages.next() (logpage, loguser, logtimestamp, logcomment) = logitem # Some logic to extract the target page. regex = u'moved to \[\[\:?Category:(?P<newcat1>[^\|\}]+)(\|[^\}]+)?\]\]|Robot: Changing Category:(.+) to Category:(?P<newcat2>.+)' m = re.search(regex, logcomment, flags=re.I) if m: if m.group('newcat1'): return self.checkCommonscatLink(m.group('newcat1')) elif m.group('newcat2'): return self.checkCommonscatLink(m.group('newcat2')) else: pywikibot.output( u'getCommonscat: Deleted by %s. Couldn\'t find move target in \" %s \"' % (loguser, logcomment)) return u'' except StopIteration: if pywikibot.verbose: pywikibot.output( u"getCommonscat: The category doesnt exist and nothing found in the deletion log.") return u''