2 # DO NOT EDIT - This file is being maintained by Chef
4 use MediaWiki\MediaWikiServices;
5 use Wikibase\Lib\SettingsArray;
7 $wgEnableWikibaseRepo = true;
8 $wgEnableWikibaseClient = true;
10 wfLoadExtension( 'WikibaseRepository', "$IP/extensions/Wikibase/extension-repo.json" );
11 wfLoadExtension( 'WikibaseClient', "$IP/extensions/Wikibase/extension-client.json" );
12 // Include Wikibase.searchindex.php to include string and text values in the full text index:
13 require_once "$IP/extensions/Wikibase/repo/config/Wikibase.searchindex.php";
15 # Adapted from $IP/extensions/Wikibase/repo/config/Wikibase.example.php
16 call_user_func( function() {
17 global $wgContentHandlerUseDB,
20 $wgNamespacesToBeSearchedDefault,
25 // Define custom namespaces. Use these exact constant names.
26 define( 'WB_NS_ITEM', $baseNs );
27 define( 'WB_NS_ITEM_TALK', $baseNs + 1 );
28 define( 'WB_NS_PROPERTY', $baseNs + 2 );
29 define( 'WB_NS_PROPERTY_TALK', $baseNs + 3 );
31 // Register extra namespaces.
32 $wgExtraNamespaces[WB_NS_ITEM] = 'Item';
33 $wgExtraNamespaces[WB_NS_ITEM_TALK] = 'Item_talk';
34 $wgExtraNamespaces[WB_NS_PROPERTY] = 'Property';
35 $wgExtraNamespaces[WB_NS_PROPERTY_TALK] = 'Property_talk';
37 $wgWBRepoSettings['entitySources'] = function ( SettingsArray $settings ) {
42 'property' => WB_NS_PROPERTY,
45 $hookContainer = MediaWikiServices::getInstance()->getHookContainer();
46 $hookContainer->run( 'WikibaseRepoEntityNamespaces', [ &$entityNamespaces ] );
49 $settings->getSetting( 'localEntitySourceName' ) => [
50 'entityNamespaces' => $entityNamespaces,
51 'repoDatabase' => false,
52 'baseUri' => $wgServer . '/entity/',
53 'rdfNodeNamespacePrefix' => 'wd',
54 'rdfPredicateNamespacePrefix' => '',
55 'interwikiPrefix' => '',
60 // Make sure we use the same keys on repo and clients, so we can share cached objects.
61 $wgWBRepoSettings['sharedCacheKeyPrefix'] = $wgDBname . ':WBL';
62 $wgWBRepoSettings['sharedCacheKeyGroup'] = $wgDBname;
64 // Include Wikibase items in the regular search result by default
65 $wgNamespacesToBeSearchedDefault[WB_NS_ITEM] = true;
67 // the special group includes all the sites in the specialSiteLinkGroups,
68 // grouped together in a 'Pages linked to other sites' section.
69 $wgWBRepoSettings['siteLinkGroups'] = [ 'special' ];
71 // these are the site_group codes as listed in the sites table
72 $wgWBRepoSettings['specialSiteLinkGroups'] = ['osm'];
74 // This option will start working in Wikibase v1.33 release. Noop until then.
75 // https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/Wikibase/+/469872/
76 $wgWBRepoSettings['enableEntitySearchUI'] = false;
80 // Adapted from "$IP/extensions/Wikibase/client/config/WikibaseClient.example.php";
82 // The global site ID by which this wiki is known on the repo.
83 // Defaults to $wgDBname.
84 // $wgWBClientSettings['siteGlobalID'] = "osm";
86 $wgWBClientSettings['injectRecentChanges'] = true;
87 $wgWBClientSettings['showExternalRecentChanges'] = true;
89 // Base URL for building links to the repository.
90 // Assumes your wiki is setup as "http://repo.example.org/wiki/"
91 // This can be protocol relative, such as "//www.wikidata.org"
92 $wgWBClientSettings['repoUrl'] = "https://wiki.openstreetmap.org";
94 // This setting is optional if you have the same type of setup for your
95 // repo and client. It will default to using the client's $wgArticlePath setting,
96 // and if you do not have $wgArticlePath set anywhere, MediaWiki has a default for it.
97 $wgWBClientSettings['repoArticlePath'] = "/wiki/$1";
99 // Assuming your wiki is setup with such script path as "http://repo.example.org/w/api.php". This
100 // should be the same as the $wgScriptPath setting if you have it set in your repo. If $wgScriptPath
101 // is not set, then MediaWiki assumes a default.
103 // If your client and repo are setup in the same way, then the below setting is optional and will
104 // default to what you have $wgScriptPath set in the client.
105 $wgWBClientSettings['repoScriptPath'] = "/w";
107 // Tell the client which namespace ID on the repo holds which type of entity.
110 define( 'WB_REPO_NS_ITEM', $baseRepoNs );
111 define( 'WB_REPO_NS_PROPERTY', $baseRepoNs + 2 );
113 $wgWBClientSettings['entitySources'] = [
115 'repoDatabase' => $wgDBname,
116 'baseUri' => $wgWBClientSettings['repoUrl'] . '/entity',
117 'entityNamespaces' => [
118 'item' => WB_REPO_NS_ITEM,
119 'property' => WB_REPO_NS_PROPERTY
121 'rdfNodeNamespacePrefix' => 'wd',
122 'rdfPredicateNamespacePrefix' => '',
123 'interwikiPrefix' => '',
127 $wgWBClientSettings['namespaces'] = [ NS_MAIN ];
129 // Avoid complaints that nobody seems to know the cause off...
130 $wgWBClientSettings['entityUsagePerPageLimit'] = 500;
132 // no edit rights for anonymous users
133 $wgGroupPermissions['*']['item-term'] = false;
134 $wgGroupPermissions['*']['item-merge'] = false;
135 $wgGroupPermissions['*']['item-redirect'] = false;
136 $wgGroupPermissions['*']['property-term'] = false;
137 $wgGroupPermissions['*']['property-create'] = false;
139 // Logged-in users can edit statements, but disable merge/redirect/creating props
140 $wgGroupPermissions['user']['item-term'] = true;
141 $wgGroupPermissions['user']['item-merge'] = false;
142 $wgGroupPermissions['user']['item-redirect'] = false;
143 $wgGroupPermissions['user']['property-term'] = true;
144 $wgGroupPermissions['user']['property-create'] = false;
146 // data-admin group should be the only one creating properties
147 $wgGroupPermissions['data-admin']['item-redirect'] = true;
148 $wgGroupPermissions['data-admin']['item-merge'] = true;
149 $wgGroupPermissions['data-admin']['property-create'] = true;
152 // See https://www.mediawiki.org/wiki/Wikibase/Installation/Advanced_configuration#Define_links_for_external_identifiers
153 $wgWBRepoSettings['formatterUrlProperty'] = 'P8';