Page MenuHomePhabricator

mwbot-rs: Support operation on multiple wikis
Open, MediumPublic

Description

Originally filed on GitLab.com

We need to support bots that operate on multiple wikis. Ideally these wikis would be able to share login sessions/connection pools.

We likely want to support using a different wiki manually, and also using a different wiki through discovery (like sitematrix).

Event Timeline

Legoktm triaged this task as Medium priority.Oct 1 2022, 2:08 AM
Legoktm created this task.

@legoktm wrote:

I've been thinking about this in the context of https://github.com/Krinkle/pywiki-fileprotectionsync/

That use case is to hit sibling wikis' APIs to query data and then make edits on the primary wiki.

One API could be Bot::get_sibling_wiki(), where you just need to provide the domain name and it constructs a new Bot instance, but shares the underlying HTTP client (note that we likely need to have mwapi allow creating a new client using an existing HTTP client.

@legoktm wrote:

And for wikis with Extension:SiteMatrix, we could have a get_sibling_via_sitematrix(a_different_identifier).

@legoktm wrote:

The concurrency lock should probably be shared across wikis.

@legoktm wrote:

Another idea, partially inspired by MZ:

In mwbot.toml

[sites.default]
api_url = "..."
rest_url = "..."

[sites.enwiki]
api_url = "..."
rest_url = "..."

[sites.commonswiki]
api_url = "..."
rest_url = "..."

Not exactly sure what it should look like in Rust. Maybe:

let config = Config::from_default().unwrap();
let bot = config.default();
let bot_commons = config.get("commons").unwrap();