Topic on Talk:Requests for comment/Future of magic links

Do not rely on communities to do the replacement

3
Strainu (talkcontribs)

My understanding is that the RFC currently implies relying on the communities to do the replacement in the year before magic links are removed. This can be quite a serious strain on smaller communities. Instead, I suggest 2 alternative solutions:

  1. Contact the communities (each and every one, yes) and see if there are local templates for the 3 magic links types and if there is anyone from the local community will do do the replacements. If there are no volunteers (or if the replacements are not complete by the deadline), do the replacements with a maintenance script (bots are not a good idea IMHO because they take a while to authorize etc.)
  2. Just create an unique template for all wikis where an identically named template does not exist and do the replacements by script.
Legoktm (talkcontribs)

I see no need for each individual Wikimedia community to re-implement the wheel to get rid of these magic links. We could have a globally approved bot do it, and have meta-wiki make an exception or something for this case.

We actually only need a template (but not really) for ISBN links, both RFC and PMID could be handled by interwiki links.

Dave Braunschweig (talkcontribs)

If anyone is interested, I used Pywikibot code similar to the following to update ISBN magic links to the ISBN template on en.wikiversity.

   def categorymembers(category):
       category = pywikibot.Category(site, category)
       pages = pywikibot.site.APISite.categorymembers(
           site,
           category=category
       )
       return pages
   
   site = pywikibot.Site("en", "wikiversity")
   pages = categorymembers("Pages using ISBN magic links")
   
   regex = re.compile("ISBN [\d\- X]*")
   for page in pages:
       title = page.title()
       text = page.text
       
       print(title)
       list = regex.findall(text)
       for item in list:
           print(item)
           item = item.strip()
           text = text.replace(item, "{{ISBN|" + item.replace("ISBN", "").strip() + "}}")

       if page.text != text:
           page.text = text
           page.save(summary="Replacing ISBN magic links with ISBN template per mw:Help:Magic links.", minor=True, botflag=True)
Reply to "Do not rely on communities to do the replacement"