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

Xqt triaged this task as High priority.Sep 16 2016, 7:42 PM

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.

@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

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.

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

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

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

Zppix subscribed.

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 task tag (T145853#2678357) and the Google-Code-in-2017 tag (no mentors).