Page MenuHomePhabricator

Impossible to establish site links
Closed, ResolvedPublic

Description

At the moment it seems impossible to create site links from an item to either Wikipedia or even the Mediawiki that comes with the docker image.

It would be good to have documentation about how to set this up or have it as an option in the docker-compose file.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Screencap of how this looks:

sitelinks.gif (580×1 px, 257 KB)

I can reproduce this behavior in the Docker Compose image but I don't have an issue in Vagrant with creating links to production Wikipedia.

localhost_8080_wiki_Item_Q2.png (1×973 px, 143 KB)

Can you tell what's inside sites table in these installation? If it's empty, that's the reason and they need to be populated using php lib/maintenance/populateSitesTable.php (According to this page). If the table is not empty, we have a bigger problem. Still we should handle this somehow. I'm not fan of docker-compose making changes to the database.

I can confirm that the sites table is empty in the stock Docker image, and that running /var/www/html/extensions/Wikibase/lib/maintenance/populateSitesTable.php populates the Wikipedia links boxes for the items I had imported from Wikidata.

Maybe that's something to be documented - to be run at intervals if Wikibase users want to establish links from items to Wikipedia?

Is there any hint, how I can manually populate site table with the active wiki, probably with ./maintenance/addSite.php?

I think it is necessary, that elasticsearch is running. If so, you can use php maintenance/eval.php in the wikibase/wikibase container with the following code:

$sites = [];
$langCode = 'en';
$site = new MediaWikiSite();
$site->setGlobalId( 'clientwiki' );
$site->setGroup( 'wikipedia' );
$site->setLanguageCode( $langCode );
$site->addInterwikiId( $langCode );
$site->addNavigationId( $langCode );
$site->setPath( MediaWikiSite::PATH_PAGE, "http://localhost:8181/wiki/$1" );
$site->setPath( MediaWikiSite::PATH_FILE, "http://wikibase.svc/w/$1" );
$sites[] = $site;
$sitesTable = SiteSQLStore::newInstance();
$sitesTable->clear();
$sitesTable->saveSites( $sites );

Setting the sitelinks should be possible then.

I think it is necessary, that elasticsearch is running. If so, you can use php maintenance/eval.php in the wikibase/wikibase container with the following code:

This should not require elasticsearch..?
What makes you think it does? It sounds like that might be the bug?

This should not require elasticsearch..?
What makes you think it does? It sounds like that might be the bug?

Yes, you're right, my fault. I've just switched off elasticsearch and it still works.

Testing it before, without elasticsearch properly installed, always got "page not found in wiki". But obviously that had other reasons.

For convenience we could probably add a maintenance script that does the above steps?
Does anyone here want to give it a shot? :)

Addshore claimed this task.

this was recently re documented.

Please see T218282#5129954