Page MenuHomePhabricator

Create configuration for matching regex
Closed, ResolvedPublic5 Estimate Story Points

Description

The wikidata bridge should be configurable to use links pointing to different repo instances other than wikidata.org.

In JavaScript, this should be exported somewhere in mw.config, under a “data bridge”-specific name; for now, we only need to support a single repo here, though in general a client can be connected to more than one repo. The value could be either a regex matching the href, or an object containing that regex and also an api.php URL.

In PHP, this should ideally work “out of the box” based on the information the client already has about the repo, though it might also be useful to be able to override this via LocalSettings.php (somewhere in $wgWBClientSettings, presumably).


Patch-For-Review: there are two independent chains implementing this, with different approaches. Either one can be merged. (Ignore all of @gerritbot’s comments below, due to change renames and abandonments they’ll just be very confusing.)

Details

Related Gerrit Patches:
mediawiki/extensions/Wikibase : masterbridge: add setting for link href regexp
mediawiki/extensions/Wikibase : masterbridge: add setting for link href regexp
mediawiki/extensions/Wikibase : masterbridge: add ResourceLoader module with config
mediawiki/extensions/Wikibase : masterbridge: conditionally load module
mediawiki/extensions/Wikibase : masterbridge: load link href regexp from config
mediawiki/extensions/Wikibase : masterbridge: add ResourceLoader module with config

Event Timeline

Michael created this task.Jun 25 2019, 11:53 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 25 2019, 11:53 AM
Lucas_Werkmeister_WMDE set the point value for this task to 5.

wbRepo is available on clients if you request the ResourceLoader module:

mw.loader.using(
  'mw.config.values.wbRepo',
  () =>  console.log( mw.config.get( 'wbRepo' ) )
);
{
  "url": "https://www.wikidata.org",
  "scriptPath": "/w",
  "articlePath": "/wiki/$1"
}

But it doesn’t contain the entity namespaces, so trying to build a regex just from that information will not work well on wikis with an Item: namespace.

Change 519238 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/Wikibase@master] bridge: add ResourceLoader module with config

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

Actually, it looks like the WikibaseClient doesn’t have the namespace names either… I can only find namespace numbers.

Change 519256 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/Wikibase@master] bridge: load link href regexp from config

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

Addshore moved this task from incoming to in progress on the Wikidata board.Jun 27 2019, 12:09 AM

Change 519392 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/Wikibase@master] bridge: add setting for link href regexp

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

Change 519425 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/Wikibase@master] bridge: WIP: conditionally load modules

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

Change 519654 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/Wikibase@master] bridge: conditionally load module

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

Change 519238 abandoned by Lucas Werkmeister (WMDE):
bridge: add ResourceLoader module with config

Reason:
the good parts of this are now in the chain of I655c2a874d

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

Change 519674 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/Wikibase@master] bridge: add setting for link href regexp

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

Change 519256 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] bridge: load link href regexp from config

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

Change 519392 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] bridge: add setting for link href regexp

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

Lucas_Werkmeister_WMDE closed this task as Resolved.Jul 1 2019, 12:21 PM
Lucas_Werkmeister_WMDE updated the task description. (Show Details)
Lucas_Werkmeister_WMDE moved this task from Peer Review to Done on the Wikidata-Bridge-Sprint-0 board.

Change 519654 abandoned by Lucas Werkmeister (WMDE):
bridge: conditionally load module

Reason:
replaced by If147649bde

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

Change 519425 abandoned by Lucas Werkmeister (WMDE):
bridge: add ResourceLoader module with config

Reason:
replaced by If9bb21ce0b

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

Change 519674 abandoned by Lucas Werkmeister (WMDE):
bridge: add setting for link href regexp

Reason:
replaced by If9bb21ce0b

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