WMDE/Wikidata/Enable Client
Enabling a Wikidata Client on Wikimedia Wikis
Preparation
- Make sure you belong to the
restricted
ordeployment
user group on production machines. - Find out the name of the database for the wiki you would like to enable a Wikidata client for.
- Find out the MediaWiki version of the wiki you would like to enable a Wikidata client for (this can be found at: MediaWiki Versions).
- Log in to orchestrator.wikimedia.org to monitor production databases during the addition process.
Adding a new Wikidata Client
1. Log into a mwmaint machine using SSH:
$ ssh maintenance.eqiad.wmnet
2. Switch the directory to the mediawiki production path (replace <mw-version>
with the current MediaWiki version for the wiki you would like to change):
$ cd /srv/mediawiki/php-<mw-version>-wmf/
3. Make sure that wikis in the wikidataclient
db list have the new wiki in their sites tables to confirm the sites can communicate with each other. If not, please follow the steps in Add a wiki#Wikidata to populate the sites tables. You can check this by entering a MySQL shell on some wikis (sql enwiki
), then running queries like SELECT * FROM sites WHERE site_global_key = 'foundationwiki';
.
4. Run mwscript
to create the entity usage table for the wiki in question (replace <wiki-dbname>
with the database name of the wiki you are making changes to):
$ mwscript sql.php --wiki=<wiki-dbname> extensions/Wikibase/client/sql/mysql/entity_usage.sql
(You can skip this if the table was already created for whatever reason; but it also shouldn’t hurt to run it again.)
5. In the operations/mediawiki-config
repository, make the following patches:
- Add the wiki in question to the
wikidataclient
db list (example: 919051), using the command:composer manage-dblist add outreachwiki wikidataclient
- (optional) Ensure the wiki is added to the correct sitelink and language link groups for Wikidata and other clients (this only applies for special cases like commons, meta or other multilingual wikis, see sitelinks example 789977, language link example 789979, and site group example 935455).
6. Schedule a deployment of the config changes (or do it yourself if you have deployment permissions).
7. When asked on IRC (if scheduled deployment), confirm that the Wikidata client is enabled by using the mwdebug browser extension:
- Go to the Special:Version page on the wiki to confirm the WikibaseClient extension is enabled.
- Try to edit the Wikimedia:Sandbox page to try to add a parser function to pull data from Wikidata (for example:
{{#property:P31|from=Q4115189}}
). - (optional) If you added sitelink and language link groups (step 5.2), make sure to check Wikidata to ensure the site appears in the correct group.
8. Wait for the deployment to complete and confirm this again on the live site.
9. After a few hours, also make sure to confirm on Wikidata itself that the site can be linked from a Wikidata item in its relevant sitelink group.
Follow-up
If the wiki is a new type of wiki (and not just a new language version of a Wikipedia or Wiktionary or similar), then it will likely be needed to add an i18n message of the form wikibase-otherprojects-<wikitype>
in WikimediaMessages. This message is used in the "other projects" sidebar section (In Vector-2022, that is in the "tools" sidebar on the right side).
Checklist
- Wikis in the
wikidataclient
db list have the wiki in question in their sites table. - The new client wiki has the
wbc_entity_usage
table. - The new client wiki is added to the
wikidataclient
db list. - The WikibaseClient extension is enabled for the new client wiki.
- The new client wiki can utilize parser functions to pull data from Wikidata.
- Wikidata Items can link to the new client wiki via sitelinks.
- There is a
wikibase-otherprojects-<wikitype>
message in the WikimediaMessages extension for its type. (For example, there is awikibase-otherprojects-wikipedia
message, it is not needed to have one for every language.)
Notes
mwmaint
is a production machine on which we can run maintenance scripts. Depending on the datacenter, the address can either bemwmaint1002.eqiad.wmnet
ormwmaint2002.codfw.wmnet
.sql wikidatawiki
gives you access to the production database (do not use the--write
flag unless you really know what you are doing).- A db list is a file containing a list of wiki db names. Common db list files are kept in the
operations/mediawiki-config
repository. foreachwikiindblist
is an alias onmwmaint
machines that can run a command on wikis in a provided db list.