There are several scripts which run on wikis where they are not configured to run. The configuration for these scripts needs to be overhauled.
Description
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Open | None | T94679 scripts that do not check site correctly | |||
Declined | None | T94680 lonelypages only checks site language, rather than checking template exists | |||
Resolved | Xqt | T94681 misspelling only uses per-language configuration, and doesnt report a problem on sites missing specified templates | |||
Open | None | T104821 Load settings from site | |||
Resolved | Xqt | T258859 misspelling.py: Add support for site wikipedia:ne |
Event Timeline
Okay maybe this could be solved similar to https://gerrit.wikimedia.org/r/#/c/201446/1 . The script just defines a class or so which takes some keyword arguments. Each Wiki has then a MediaWiki:FOO.js JSON content (where FOO could be defined by the script or maybe pywikibot-<scriptname>). It then loads the JSON content and calls whatever is there to initialize the settings. So in the case of my patch the page would contain then on the English Wikipedia:
{ "name": "Orphan", "aliases": ["wi"], "parameters": "date={{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}" }
And it would do then something like that in the script:
settings_page = 'pywikibot-lonelypages' pywikibot.bot.load_settings(settings_page, OrphanTemplate)
And then in the library we have a function which does some magic:
def load_settings(page_title, callback, site=None): site = site or pywikibot.Site() page = pywikibot.Page(site, page_title + '.js', 12) if page.exists(): return callback(**json.loads(page.get())) else: return False
We could do something similar also to implement some family configuration variables (like where the categories/interwiki links go) like suggested in T89451: Reducing complexity of the Family class.
Change 201446 had a related patch set uploaded (by XZise):
[FEAT] Load the settings from wiki