From ec0bc46d1275fc39a116736fc40372b0f6784fd0 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 26 Apr 2022 19:07:48 +0100 Subject: [PATCH] Update client configuration for Wikibase --- .../default/mw-ext-Wikibase.inc.php.erb | 45 +++++++++++++++++-- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/cookbooks/wiki/templates/default/mw-ext-Wikibase.inc.php.erb b/cookbooks/wiki/templates/default/mw-ext-Wikibase.inc.php.erb index da194cad7..e12205b77 100644 --- a/cookbooks/wiki/templates/default/mw-ext-Wikibase.inc.php.erb +++ b/cookbooks/wiki/templates/default/mw-ext-Wikibase.inc.php.erb @@ -56,13 +56,52 @@ call_user_func( function() { } ); -// Adapted from "$IP/extensions/Wikibase/client/ExampleSettings.php"; +// Adapted from "$IP/extensions/Wikibase/client/config/WikibaseClient.example.php"; // The global site ID by which this wiki is known on the repo. // Defaults to $wgDBname. // $wgWBClientSettings['siteGlobalID'] = "osm"; -// $wgWBClientSettings['injectRecentChanges'] = true; -// $wgWBClientSettings['showExternalRecentChanges'] = true; + +$wgWBClientSettings['injectRecentChanges'] = true; +$wgWBClientSettings['showExternalRecentChanges'] = true; + +// Base URL for building links to the repository. +// Assumes your wiki is setup as "http://repo.example.org/wiki/" +// This can be protocol relative, such as "//www.wikidata.org" +$wgWBClientSettings['repoUrl'] = "https://wiki.openstreetmap.org"; + +// This setting is optional if you have the same type of setup for your +// repo and client. It will default to using the client's $wgArticlePath setting, +// and if you do not have $wgArticlePath set anywhere, MediaWiki has a default for it. +$wgWBClientSettings['repoArticlePath'] = "/wiki/$1"; + +// Assuming your wiki is setup with such script path as "http://repo.example.org/w/api.php". This +// should be the same as the $wgScriptPath setting if you have it set in your repo. If $wgScriptPath +// is not set, then MediaWiki assumes a default. +// +// If your client and repo are setup in the same way, then the below setting is optional and will +// default to what you have $wgScriptPath set in the client. +$wgWBClientSettings['repoScriptPath'] = "/w"; + +// Tell the client which namespace ID on the repo holds which type of entity. +$baseRepoNs = 120; + +define( 'WB_REPO_NS_ITEM', $baseRepoNs ); +define( 'WB_REPO_NS_PROPERTY', $baseRepoNs + 2 ); + +$wgWBClientSettings['entitySources'] = [ + 'local' => [ + 'repoDatabase' => 'repo', + 'baseUri' => $wgWBClientSettings['repoUrl'] . '/entity', + 'entityNamespaces' => [ + 'item' => WB_REPO_NS_ITEM, + 'property' => WB_REPO_NS_PROPERTY + ], + 'rdfNodeNamespacePrefix' => 'wd', + 'rdfPredicateNamespacePrefix' => '', + 'interwikiPrefix' => '', + ], +]; $wgWBClientSettings['namespaces'] = [ NS_MAIN ]; -- 2.43.2