Extension:UnlinkedWikibase
UnlinkedWikibase Release status: beta |
|
---|---|
Implementation | Parser function |
Description | Access to Wikibase entities from wikis that are not linked to a Wikibase site. |
Author(s) | Sam Wilson (Samwilsontalk) |
Latest version | 3.1.3 (2024-05-25) |
Compatibility policy | Master maintains backward compatibility. |
MediaWiki | >= 1.38 |
Database changes | No |
Composer | samwilson/unlinked-wikibase |
License | GNU General Public License 2.0 or later |
Download | |
Help | Help:Extension:UnlinkedWikibase |
|
|
Quarterly downloads | 2 (Ranked 139th) |
Translate the UnlinkedWikibase extension if it is available at translatewiki.net | |
Vagrant role | unlinkedwikibase |
Issues | Open tasks · Report a bug |
The UnlinkedWikibase extension provides access to Wikibase entities from wikis that are not linked to a Wikibase site. For example, a private wiki with a page about Goats could retrieve metadata from the Wikidata item goat (Q2934) and display it in an infobox. See the help page for more information about using it.
Installation
edit- Download and move the extracted
UnlinkedWikibase
folder to yourextensions/
directory.
Developers and code contributors should install the extension from Git instead, using:cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/UnlinkedWikibase - Add the following code at the bottom of your LocalSettings.php file:
wfLoadExtension( 'UnlinkedWikibase' );
- Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
Upgrading
editBreaking change: When upgrading from 2.0 to 3.0, note that mw.ext.UnlinkedWikibase.getEntity()
has changed to return 1-index arrays rather than 0-indexed as previously. For example, the value of the first title (P1476) claim should be found with item.claims.P1476[1].mainsnak.datavalue.value.text
rather than item.claims.P1476[0].mainsnak.datavalue.value.text
.
Configuration
editTo link to a different Wikibase other than Wikidata, set the following two configuration variables:
$wgUnlinkedWikibaseBaseUrl = 'https://xxx.wikibase.cloud/wiki/';
$wgUnlinkedWikibaseBaseQueryEndpoint = 'https://xxx.wikibase.cloud/query/sparql';
Entities and queries are cached for 1 and 60 minutes respectively. These can be changed as follows:
$wgUnlinkedWikibaseQueryTTL = 3600;
$wgUnlinkedWikibaseEntityTTL = 60;
Note that $wgUnlinkedWikibaseEntityTTL
can be set to null
if you wish to use the maintenance script to refresh the cache (see below for details).
To enable an experimental {{#statements:}}
parser function that operations similarly to the Wikibase parser function of the same name, add the following to LocalSettings.php:
$wgUnlinkedWikibaseStatementsParserFunc = true;
Note that this is experimental and may require changes to make it compatible with the new parser (e.g. requiring the |from=
parameter).
Maintenance script
editThere is a maintenance script that can be used to update the cached Wikibase entity data. It's of most use if you set $wgUnlinkedWikibaseEntityTTL = null
, which will prevent the external requests from being run (other than the first time).
Run it as follows:
$ php ./maintenance/run UnlinkedWikibase:UpdateEntities
See also
editThis extension is included in the following wiki farms/hosts and/or packages: This is not an authoritative list. Some wiki farms/hosts and/or packages may contain this extension even if they are not listed here. Always check with your wiki farms/hosts or bundle to confirm. |