Page MenuHomePhabricator

scripts that do not check site correctly
Open, MediumPublic


There are several scripts which run on wikis where they are not configured to run. The configuration for these scripts needs to be overhauled.

Event Timeline

jayvdb created this task.Apr 1 2015, 10:08 AM
jayvdb raised the priority of this task from to Medium.
jayvdb updated the task description. (Show Details)
jayvdb added a project: Pywikibot.
jayvdb added a subscriber: jayvdb.
Restricted Application added subscribers: Aklapper, Unknown Object (MLST). · View Herald TranscriptApr 1 2015, 10:08 AM
XZise added a subscriber: XZise.Apr 2 2015, 3:08 PM

Okay maybe this could be solved similar to . 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', 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()))
        return False
XZise added a comment.Apr 3 2015, 1:26 AM

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