X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/bf62d713fcd6cfb0dbeb1ae3ce347d4df96743f7..06f75772a25febcfd00bfb8607ce3931520adb22:/cookbooks/wiki/templates/default/mw-ext-Wikibase.inc.php.erb?ds=sidebyside 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 ff82b0ccb..6f7e8d6eb 100644 --- a/cookbooks/wiki/templates/default/mw-ext-Wikibase.inc.php.erb +++ b/cookbooks/wiki/templates/default/mw-ext-Wikibase.inc.php.erb @@ -1,11 +1,14 @@ WB_NS_ITEM, + 'property' => WB_NS_PROPERTY, + ]; + + $hookContainer = MediaWikiServices::getInstance()->getHookContainer(); + $hookContainer->run( 'WikibaseRepoEntityNamespaces', [ &$entityNamespaces ] ); + + return [ + $settings->getSetting( 'localEntitySourceName' ) => [ + 'entityNamespaces' => $entityNamespaces, + 'repoDatabase' => false, + 'baseUri' => $wgServer . '/entity/', + 'rdfNodeNamespacePrefix' => 'wd', + 'rdfPredicateNamespacePrefix' => '', + 'interwikiPrefix' => '', + ], + ]; + }; // Make sure we use the same keys on repo and clients, so we can share cached objects. - $wgWBRepoSettings['sharedCacheKeyPrefix'] = $wgDBname; + $wgWBRepoSettings['sharedCacheKeyPrefix'] = $wgDBname . ':WBL'; + $wgWBRepoSettings['sharedCacheKeyGroup'] = $wgDBname; // Include Wikibase items in the regular search result by default $wgNamespacesToBeSearchedDefault[WB_NS_ITEM] = true; @@ -56,15 +77,55 @@ 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' => $wgDBname, + 'baseUri' => $wgWBClientSettings['repoUrl'] . '/entity', + 'entityNamespaces' => [ + 'item' => WB_REPO_NS_ITEM, + 'property' => WB_REPO_NS_PROPERTY + ], + 'rdfNodeNamespacePrefix' => 'wd', + 'rdfPredicateNamespacePrefix' => '', + 'interwikiPrefix' => '', + ], +]; $wgWBClientSettings['namespaces'] = [ NS_MAIN ]; +$wgWBClientSettings['repoSiteName'] = 'Data Items'; // Avoid complaints that nobody seems to know the cause off... $wgWBClientSettings['entityUsagePerPageLimit'] = 500; @@ -91,8 +152,3 @@ $wgGroupPermissions['data-admin']['property-create'] = true; // See https://www.mediawiki.org/wiki/Wikibase/Installation/Advanced_configuration#Define_links_for_external_identifiers $wgWBRepoSettings['formatterUrlProperty'] = 'P8'; - -// Disable Wikibase searchbox with this hack (hopefully Wikibase will implement support for it soon) -// See https://phabricator.wikimedia.org/T205560 -// After upgrading to Wikibase 1.33, this line can be deleted. The 'enableEntitySearchUI' above will do the same thing. -$wgResourceModules['wikibase.ui.entitysearch']['scripts'] = [];