Wikibase/Installation/Advanced configuration

= Introduction = This page describes advanced configuration for Wikibase's Client and Repository. If you haven't yet installed Wikibase, first consult the installation instructions.

Making changes to the client and repository configurations involves adding r changing  or   lines (respectively) in the MediaWiki  file. This document covers only some options; for an exhaustive list, consult full documentation (defaults: and  ).

Note that the prefix "wg" in  is distinct from that of other extensions, which may use the prefix. The difference is important; your configuration will fail if you use a different prefix.

The parameters you set in override those found in the aforementioned files. Place any configuration settings you wish to override at the bottom of your file.

Example:

The line above sets the parameter  of the Wikibase Repository (because  ) to the value.

= Wikibase repository =

Define links for external identifiers
In order to add links for external identifiers in the main interface (as seen in this Wikidata example Q85#P214 and config P214#P1630):
 * 1) Create a property of type String (e.g., P214#P1630).
 * 2) Get the property's ID (e.g.,  ).
 * 3) Configure in  :
 * 4) If adding the setting does not work on its own, run the following script:
 * 5) Now users can define the pattern of the links, with   replaced by the identifier provided by each individual item.

Canonical URIs can be similarly configured in RDF dumps (prefixes wdtn:, psn:, pqn:, prn:), as seen on Wikidata with the property P1921 and used on the property P214#P1921). The configuration is similar to the parameter.

Optional settings
propertyOrderUrl allows custom ordering of properties using the LUA function  as explained in Manual:Interface/Wikibase-SortedProperties

statementSections allows grouping items into several sections. For instance, to replicate how Wikidata separates External identifiers from the rest of its properties, set: Then set the name of the label on the  page.

= Available configuration settings =

All available configuration settings are noted in the master configuration document.

= Maintenance scripts = Wikibase provides a few maintenance scripts which can be found in the  subdirectory. Wikibase must be installed in MediaWiki's extensions directory,. If it's installed elsewhere, you can set the  environment variable to the path of your MediaWiki installation and the scripts will use it.

Repo
A common way to set the environment for scripts called in cron jobs:

populateSitesTable.php
This script will load the wiki matrix from meta.wikimedia.org and use that information to populate the local  table. This provides Wikibase with the information it needs to connect to other wikis, such as for the purpose of suggesting or normalizing page titles when creating site links.

From the MediaWiki install folder, run:

To insert a new Wikibase client without using the wiki matrix, see Manual:Sites table.

Dispatch changes
This script updates the client wiki's local items cache.


 * 1) Provide the script with the information it needs about the client wiki databases.

LocalSettings.php:


 * 1) Run the dispatch changes script.

Note that this script performs the synchronization; the repo and the client will remain in sync only so long as this script is running.

pruneChanges.php
This script allows you to prune the Wikibase changes table. When run with no parameters, it will delete all changes older than 7 days. You may specify the  flag for periods of other lengths:

= Features & usage = After Wikibase is installed, interlanguage links are automatically obtained from the repo and added to client wiki pages as long as the polling script is running. The extension then sorts the links (as defined by the local wiki), displays them and saves them to the database exactly as they are defined on the page. The extension is robust and retains existing links when the central wiki is down.

By default the extension works only in the main namespace, but this can be changed using the namespaces configuration option.

Mixing Wikidata and local interlanguage links
The extension doesn't affect how interlanguage links work; they can be used in parallel with the extension. There are several use cases:


 * Links on pages in namespaces not configured to use the extension will work as if the extension were not installed.
 * If you want to add links in addition to the links stored in Wikidata, simply add new links in wikitext; your links and the Wikidata links will be displayed together.
 * To exclude one or more Wikidata links, use noexternallanglinks with the desired language(s). Other links will work normally.
 * To supersede one or more Wikidata links, use noexternallanglinks and add the new links in wikitext.
 * To turn off Wikidata links altogether, use noexternallanglinks on its own. Links you provide will work as if the extension were not installed.

noexternallanglinks
is a magic word and a parser function which can turn this extension off for a specific page, or suppress some of the interlanguage links produced by the extension.

When used on its own, Wikibase is effectively disabled on the given page. Only interlanguage links present in the wikitext are used. The word works the same when used as a function, with an asterisk:  (the asterisk "matches" all the languages).

When invoked as a function with parameters, links to the specified languages will be removed. For example,  removes links to French and Indonesian languages. You may also invoke the function more than once:. It is safe to remove links to languages that don't exist.

Data transclusion
WikibaseClient allows data inclusion from the Wikibase repo using the  parser function along with Lua.


 * Lua
 * Lua documentation


 * Parser functions
 * Lookup by property ID (e.g., P2), to include data from a Wikibase item connected by sitelink. For example,.
 * Lookup by property label. For example,.
 * With arbitrary access enabled, it can be applied to any item. For example,.
 * In addition to, which outputs linked wikitext, you can use  , which outputs unlinked labels.
 * See d:Wikidata:How to use data on Wikimedia projects for further documentation.

Other projects sidebar

 * ''See also Requests for comment/Interproject links interface for the current status for Wikimedia projects.

The configuration option  creates an "Other projects" sidebar section with links to other projects from the item linked to the current page. It currently supports exactly one link per project and does not yet override links in wikitext using a parser function (though current JavaScript hacks may be easily adapted).

Configuration sample (links will be displayed in the order specified):

The sidebar's id is "wikibase-otherprojects". You can use it to customize the section's position in the sidebar using MediaWiki:Sidebar.

Each link has a the label containing the i18n messages "wikibase-otherprojects- ID " with ID the id of the linked site group (like "wikipedia", "wikisource" or "commons").

Sample page: w:Wikipedia:Village pump.

commaseparatedlist
is a parser function that can be used in edit summaries for text formatting. It returns its list of arguments separated by the given language's proper separator. for example, results in word1, word2, word3.