]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/wiki/templates/default/mw-ext-Wikibase.inc.php.erb
wordpress: add additional required packages
[chef.git] / cookbooks / wiki / templates / default / mw-ext-Wikibase.inc.php.erb
index e12205b77b693e841cb47f90bcd5fd5607ed302b..6f7e8d6ebb7a22e75531ebd1d694dd32e45e922c 100644 (file)
@@ -1,11 +1,14 @@
 <?php
 # DO NOT EDIT - This file is being maintained by Chef
 
+use MediaWiki\MediaWikiServices;
+use Wikibase\Lib\SettingsArray;
+
 $wgEnableWikibaseRepo = true;
 $wgEnableWikibaseClient = true;
 
-require_once "$IP/extensions/Wikibase/repo/Wikibase.php";
-require_once "$IP/extensions/Wikibase/client/WikibaseClient.php";
+wfLoadExtension( 'WikibaseRepository', "$IP/extensions/Wikibase/extension-repo.json" );
+wfLoadExtension( 'WikibaseClient', "$IP/extensions/Wikibase/extension-client.json" );
 // Include Wikibase.searchindex.php to include string and text values in the full text index:
 require_once "$IP/extensions/Wikibase/repo/config/Wikibase.searchindex.php";
 
@@ -17,8 +20,6 @@ call_user_func( function() {
         $wgNamespacesToBeSearchedDefault,
         $wgWBRepoSettings;
 
-    $wgContentHandlerUseDB = true;
-
     $baseNs = 120;
 
     // Define custom namespaces. Use these exact constant names.
@@ -33,12 +34,32 @@ call_user_func( function() {
     $wgExtraNamespaces[WB_NS_PROPERTY] = 'Property';
     $wgExtraNamespaces[WB_NS_PROPERTY_TALK] = 'Property_talk';
 
-    // Tell Wikibase which namespace to use for which kind of entity
-    $wgWBRepoSettings['entityNamespaces']['item'] = WB_NS_ITEM;
-    $wgWBRepoSettings['entityNamespaces']['property'] = WB_NS_PROPERTY;
+    $wgWBRepoSettings['entitySources'] = function ( SettingsArray $settings ) {
+        global $wgServer;
+
+        $entityNamespaces = [
+            'item' => 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;
@@ -91,7 +112,7 @@ define( 'WB_REPO_NS_PROPERTY', $baseRepoNs + 2 );
 
 $wgWBClientSettings['entitySources'] = [
         'local' => [
-                'repoDatabase' => 'repo',
+                'repoDatabase' => $wgDBname,
                 'baseUri' => $wgWBClientSettings['repoUrl'] . '/entity',
                 'entityNamespaces' => [
                         'item' => WB_REPO_NS_ITEM,
@@ -104,6 +125,7 @@ $wgWBClientSettings['entitySources'] = [
 ];
 
 $wgWBClientSettings['namespaces'] = [ NS_MAIN ];
+$wgWBClientSettings['repoSiteName'] = 'Data Items';
 
 // Avoid complaints that nobody seems to know the cause off...
 $wgWBClientSettings['entityUsagePerPageLimit'] = 500;