From e253b8446114ffe0207ae3731fa90c6af4ef0e95 Mon Sep 17 00:00:00 2001 From: Eloi Ferrer Date: Tue, 5 Sep 2023 08:21:57 +0000 Subject: [PATCH] refactor to use wikibase host and port --- mediawiki/LocalSettings.d/Wikibase.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/mediawiki/LocalSettings.d/Wikibase.php b/mediawiki/LocalSettings.d/Wikibase.php index e0297f7..67d2926 100644 --- a/mediawiki/LocalSettings.d/Wikibase.php +++ b/mediawiki/LocalSettings.d/Wikibase.php @@ -4,17 +4,25 @@ wfLoadExtension( 'WikibaseClient', "$IP/extensions/Wikibase/extension-client.json" ); require_once "$IP/extensions/Wikibase/client/ExampleSettings.php"; +$wikibaseHost = getenv('WIKIBASE_HOST'); + +if ($wikibaseHost === 'localhost') { + $portalHost = getenv('WIKIBASE_SCHEME') . '://localhost:' . getenv('WIKIBASE_PORT'); +} else { + $portalHost = getenv('WIKIBASE_SCHEME') . $wikibaseHost; +} + # enable linking between wikibase and content pages $wgWBRepoSettings['siteLinkGroups'] = [ 'mathematics' ]; $wgWBClientSettings['siteLinkGroups'] = [ 'mathematics' ]; $wgWBClientSettings['siteGlobalID'] = 'mardi'; -$wgWBClientSettings['repoUrl'] = getenv('WIKIBASE_SCHEME') . '://' . getenv('PORTAL_HOST'); +$wgWBClientSettings['repoUrl'] = $portalHost; $wgWBClientSettings['repoScriptPath'] = '/w'; $wgWBClientSettings['repoArticlePath'] = '/wiki/$1'; $wgWBClientSettings['entitySources'] = [ 'mardi_source' => [ 'repoDatabase' => 'my_wiki', - 'baseUri' => getenv('WIKIBASE_SCHEME') . '://' . getenv('PORTAL_HOST') . '/entity', + 'baseUri' => $portalHost . '/entity', 'entityNamespaces' => [ 'item' => 120, 'property' => 122,