Page MenuHomePhabricator

harvest_template.py should import item of redirect, not item of target page
Open, LowPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

  • pwb.py harvest_template -prefixindex:Wikipedie:Pískoviště -template:"Hlavní článek" "1" P301 -lang:cs

there are three redirects:

  1. redirect (without wikidata item) to another article
  2. redirect to section of another item (both redirect and target have own wikidata item)
  3. redirect to another article (both redirect and target have own wikidata item)

2 and 3 are marked as Wikidata redirect with template Q16956589

What happens?:
Script imports Q144, Q11567 and Q1471

What should have happened instead?:

script should import Q144, Q9165172 and Q472766

See also T54564

Event Timeline

JAnD renamed this task from harvest_template.py should import target of redirected page to harvest_template.py should import item of redirect, not item of target page.Jul 1 2022, 7:15 PM

Cannot follow this issue and need any help. Let's explore the last added Q1471 which is intended to be Q472766:

  • The starting link text is Sequana and HarvestRobot._template_link_target found [[cs:Sequana]] as linked_page
  • [[cs:Sequana]] is a redirect and the method above uses the redirect target which is [[cs:Saina]]
  • The corresponing wikibase item of [[cs:Saina]] is Q1471.
  • [[cs:Sequana]] indeed has its own wikibase item which is Q472766

This is a bit confusing to me but looking forward the behaviour must be cleared:

When should the redirect page be used?

  1. always; there is no default. create a wikibase item if it does not exist.
  2. if a wikibase item not exists, otherwise use the current behavior as default
  3. if a wikibase item not exists or there is no __STATICREDIRECT__ given for the redirect
  4. if a wikibase item not exists or there is not a wikidate redirect template inside the redirect page (Q16956589), otherwise use the current behavior as default
  5. Other behaviour
  6. One of 1-4 above but with an additional bot option
  7. never; the current behaviour is the right one
Xqt triaged this task as Medium priority.Jul 2 2022, 3:00 PM

Change 810472 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] [IMPR] Only follow redirects in harvest_template.py if no wikibase item exists

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

Xqt lowered the priority of this task from Medium to Low.Jul 3 2022, 9:22 AM

I keep this open to discuss whether harvest_templates should follow redirects under the condition

  • there is no __STATICREDIRECT__ magic word
  • there is not WD template Q16956589
  • the new behaviour should only work with a new option

Change 810472 merged by Xqt:

[pywikibot/core@master] [IMPR] Only follow redirects in harvest_template.py if no wikibase item exists

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