Topic on Project:Support desk

Wikibase on third-party wikis

5
Summary by Till Kraemer

Using Wikibase on third-party wikis can be a problem if you run php_fpm in a chroot jail. Make sure DNS works inside the chroot.

Till Kraemer (talkcontribs)

Hi,

I'm trying to use Wikibase on my pool wiki and language wikis.

In my pool wiki, I can create properties and items, but I can't add site links to them. ID: "Q1", site id: "cswiki", site link: "article name" gives me the error "The specified article could not be found on the corresponding site." even though that article exists on cswiki.

I also can't access data from the language wikis. If I use {{#property:P1}} in an article on cswiki, nothing shows up.

I downloaded Wikidata-refs-heads-master.tar.gz and extracted it to the extension folder of my pool wiki and language wikis.

My LocalSettings.php of the pool wiki looks like this:

# Wikibase
$wgEnableWikibaseRepo = true;
$wgEnableWikibaseClient = false;
$wmgUseWikibaseRepo = true;
$wmgUseWikibaseClient = false;
require_once __DIR__ . "/extensions/Wikidata/Wikidata.php";
require_once __DIR__ .
"/extensions/Wikidata/extensions/Wikibase/repo/ExampleSettings.php";

# SiteMatrix Extension
require_once "$IP/extensions/SiteMatrix/SiteMatrix.php";
$wgLocalDatabases = array( 'cswiki', 'dewiki', 'enwiki', 'eswiki',
'frwiki', 'huwiki', 'hywiki', 'itwiki', 'nlwiki', 'plwiki', 'poolwiki',
'ptwiki', 'ruwiki', 'srwiki', 'svwiki' );

My LocalSettings.php of the language wikis (cs for example) look like this:

# Wikibase Extension
$wgEnableWikibaseRepo = false;
$wgEnableWikibaseClient = true;
$wmgUseWikibaseRepo = false;
$wmgUseWikibaseClient = true;
require_once __DIR__ . "/extensions/Wikidata/Wikidata.php";

# Settings
$wgWBSettings['repoUrl'] = 'http://pool.mypedia.com';
$wgWBSettings['repoScriptPath'] = '/w';
$wgWBSettings['repoArticlePath'] = '/wiki/$1';
$wgWBSettings['siteGlobalID'] = 'cswiki';
$wgWBSettings['repoDatabase'] = 'poolwiki';
$wgWBSettings['changesDatabase'] = 'poolwiki';

# Optional
$wgWBSettings['siteGroup'] = 'mypedia';
$wgWBSettings['sort'] = 'code'; //optional
$wgWBSettings['sortPrepend'] = array(
        'cs'
);

In populateSitesTable.php, I changed "https://meta.wikimedia.org/w/api.php" to "http://pool.mypedia.com/w/api.php" and "$validGroups = array( 'wikipedia', 'wikivoyage', 'wikiquote', 'wiktionary','wikibooks', 'wikisource', 'wikiversity', 'wikinews' );" to "$validGroups = array( 'mypedia' );"

Do I need to change "$wikiId = $this->getOption( 'wiki' );" too, since it says "wiki" is expanded to "wikipedia"?

Table "sites" in the poolwiki database looks like this:

site_id | site_global_key | site_type | site_group | site_source | site_language | site_protocol | site_domain | site_data | site_forward | site_config

1 | cswiki | mediawiki | mypedia | local | cs | http:// | com.mypedia.cs. | a:1:{s:5:"paths";a:2:{s:9:"file_path";s:5:"/w/$1";s:9:"page_path";s:8:"/wiki/$1";}} | 0 | a:0:{}

[...]

15 | poolwiki | mediawiki | pool | local | en | http:// | com.mypedia.pool. | a:1:{s:5:"paths";a:2:{s:9:"file_path";s:5:"/w/$1";s:9:"page_path";s:8:"/wiki/$1";}} | 0 | a:0:{}

I changed site_group "wikipedia" to "mypedia" and added data for site_protocol and site_domain by hand.

I noticed that the script path is "/w/$1" here, while $wgScriptPath in LocalSettings.php is actually "/w", could that cause any problems?

And should I change site_group of the pool to mypedia like I did with the language wikis or isn't that necessary?

Wikibase DataModel 0.8, Wikibase Repository 0.5 alpha, WikibaseLib 0.5 alpha and Wikidata show up in Special:Version of the pool wiki.

Wikibase Client 0.5 alpha, Wikibase DataModel 0.8, WikibaseLib 0.5 alpha and Wikidata show up in Special:Version of the language wikis.

MediaWiki 1.23.0, PHP 5.3.27 (fpm-fcgi), MySQL 5.1.70-log.

Any help would be really appreciated!

Thanks and cheers,

Till Kraemer (talkcontribs)

Hi,

for my own Wikibase repository to work on my third party wikis, do I need to set site_source in sites table to local on the repository database and to the database name of the repository in the client databases?

Thanks and cheers,

Till Kraemer (talkcontribs)

I'm now running MediaWiki 1.24.0. I can create items and properties in the repository but I can't add pages linked to an item. It always gives me the error "The specified article could not be found on the corresponding site. Details: The external client site did not provide page information".

On articles in the language wikis sometimes the "Add links" section appears, but if I click it to actually add some links, instantly "Error:" appears. On the page information it says "Datawiki item ID: None".

In the log files of the language wikis, the following entries show up:

[caches] main: MemcachedPhpBagOStuff, message: MemcachedPhpBagOStuff, parser: MemcachedPhpBagOStuff
Unstubbing $wgLang on call of $wgLang::unstub from Wikibase\Client\Hooks\SidebarHookHandlers::newFromGlobalState
[caches] LocalisationCache: using store LCStoreDB
Connected to database 0 at 12.34.56.78
[Wikibase\Client\WikibaseClient] getSite: The configured local id cs does not match any local ID of site cswiki: array ()
[Wikibase\SettingsArray] getSetting: setting otherProjectsLinkswas given as a closure, resolve it to array ()
[Wikibase\LangLinkHandler] getEntityLinks: Looking for sitelinks defined by the corresponding item on the wikibase repo.
LoadBalancer::openForeignConnection: opened new connection for 0/poolwiki
LoadBalancer::reuseConnection: freed connection 0/poolwiki
[Wikibase\LangLinkHandler] getEntityLinks: No corresponding item found for My Article
[Wikibase\LangLinkHandler] getEntityLinks: Found 0 links.
LoadBalancer::openForeignConnection: reusing free connection 0/poolwiki
LoadBalancer::reuseConnection: freed connection 0/poolwiki
LoadBalancer::openForeignConnection: reusing free connection 0/poolwiki
LoadBalancer::reuseConnection: freed connection 0/poolwiki
[warning] Failed to map interlanguage prefix de to a global site ID. [Called from Wikibase\LangLinkHandler::localLinksToArray 
in /path/to/wiki/cs/w/extensions/Wikidata/extensions/Wikibase/client/includes/LangLinkHandler.php at line 350]

Any help is more than appreciated.

Thanks and cheers,

Mika77 (talkcontribs)

How did you solve this issue?

Till Kraemer (talkcontribs)

@Mika77, thanks for your question and sorry I didn't post my solution earlier. I had problems running Wikibase, because php_fpm was running in a chroot jail. That's why I also had trouble fetching image descriptions. Cheers!