Page MenuHomePhabricator

unusedfiles.py: if an image is already tagged, don't tag it again
Open, LowestPublic

Description

unusedfiles.py tags orphan files, however on each run, it tags again the files even if they were tagged previously. Please prevent the bot from tagging the image again if already tagged. Thank you.

Event Timeline

Restricted Application added subscribers: pywikibot-bugs-list, Aklapper. · View Herald TranscriptSep 16 2016, 9:34 AM
Xqt triaged this task as High priority.Sep 16 2016, 7:42 PM
Restricted Application added a subscriber: TerraCodes. · View Herald TranscriptSep 24 2016, 4:44 PM

Similarly, lonelypages.py also do.

MarcoAurelio : In unusedfiles.py there is code to check this. Can you elaborate more on this?

MarcoAurelio : In unusedfiles.py there is code to check this. Can you elaborate more on this?

I'm afraid I don't know how to explain further. Please see https://meta.wikimedia.org/w/index.php?title=File:Head_logo.jpg&action=history for the issue (just one random file chosen, although they're more).

I've changed the template in my local repo, so it's not the same as in rPWBC, but it should still work.

Mpaa added a subscriber: Mpaa.Sep 25 2016, 8:55 PM

@Anoopchandu18, the template is searched "as is" in text.

if self.template_image in image.text

Maybe better to construct a template page from 'self.template_image' and check if it is in image.templates()?

Change 313309 had a related patch set uploaded (by Mpaa):
unusedfiles.py: do not tag image if already tagged

https://gerrit.wikimedia.org/r/313309

Xqt added a comment.Sep 29 2016, 2:53 AM

I think it is insufficient to check for the template only. Looking at the file page I found an additional but still undocumented parameter for the template. I guess the bot script should be changed to tag this new parameter too.

Xqt lowered the priority of this task from High to Lowest.Sep 29 2016, 3:19 AM

decrease prio because this bug is caused by a modified script but the enhencement should be added.

I think it is insufficient to check for the template only. Looking at the file page I found an additional but still undocumented parameter for the template. I guess the bot script should be changed to tag this new parameter too.

My local PWB copy is already modified to tag with that new parameter.

@MarcoAurelio could you please explain the new parameter(s) you have added.
https://meta.wikimedia.org/w/index.php?title=Template:Orphan_file&action=history

It allows categorizing by date to allow better maintenance with a subst:#time.

Xqt added a comment.Sep 29 2016, 3:12 PM

looks like Timestamp.strftime('%d %B %Y')

Mpaa added a comment.Sep 29 2016, 8:50 PM

OK, so different parameters to be added for different templates/sites?
It starts to get complicated.

Xqt added a comment.Sep 30 2016, 12:41 AM

It starts to get complicated

everyone can do it if it is simple ;-)

Change 313309 abandoned by Mpaa:
unusedfiles.py: do not tag image if already tagged

https://gerrit.wikimedia.org/r/313309

Framawiki moved this task from Backlog to Doing on the good first bug board.Dec 2 2017, 1:31 PM
Framawiki moved this task from Doing to Backlog on the good first bug board.
Zppix added a subscriber: Zppix.

I can't mentor this as im not familar with pywikibot but I believe this to be a good GCI task.

Given the previous comments in this task I'm removing both the good first bug tag (T145853#2678357) and the Google-Code-in-2017 tag (no mentors).