Last modified: 2014-09-02 01:29:00 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T57086, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 55086 - Make commonscat.py use deletion summaries
Make commonscat.py use deletion summaries
Status: RESOLVED FIXED
Product: Pywikibot
Classification: Unclassified
Other scripts (Other open bugs)
unspecified
All All
: Unprioritized enhancement
: ---
Assigned To: Pywikipedia bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-05 04:21 UTC by Kunal Mehta (Legoktm)
Modified: 2014-09-02 01:29 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Kunal Mehta (Legoktm) 2013-10-05 04:21:59 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\).
Comment 1 Maarten Dammers 2013-10-10 18:18:38 UTC
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''

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links