Extension:Interwiki
![]() 發佈狀態: 穩定版本 |
|
---|---|
![]() |
|
实现 | 特殊页面 |
描述 | 添加一個特殊頁面以查看和操作跨wiki数据表 |
作者 | Stephanie Amanda Stevens, SPQRobin |
最新版本 | 3.2 (2019-07-15) |
MediaWiki | 1.36+ |
数据库更改 | 否 |
许可协议 | GNU通用公眾授權條款2.0或更新版本 |
下載 | |
示例 | 参见Extension:Interwiki/Sites using this extension |
|
|
interwiki |
|
季度下載量 | 130 (Ranked 77th) |
公開的wiki使用 | 4,929 (Ranked 181st) |
翻譯Interwiki的扩展,若在translatewiki.net可用 | |
問題 | 尚未完成的工作 · 报告錯誤 |
Interwiki 扩展将"Special:Interwiki"页面添加到 MediaWiki ,以查看和编辑 interwiki 表,以及使用它所做的任何操作的日志。
它适用于 $wgInterwikiCache 变量。 与之相关的跨wiki表更改会影响transclusion 和interwiki links 的行为。
"Special:Interwiki" 的列表与 API api.php?action=query&meta =siteinfo&siprop=interwikimap
相同,只是 iw_api
字段不可用。
下載
此扩展可直接从Git检索到 [?]:
- 浏览代码
- 部分扩展有稳定版本标签。
- 浏览标签
- 选择标签
- 点击“快照”
- 每个分支与过去的MediaWiki发布版本相关联。 这里也有一个“主线”分支,包含最新alpha版本(可能需要MediaWiki的alpha版本)。
- 浏览分支
- 选择一个分支名称
- 点击“继续”
提取快照,并将它放置在您的MediaWiki安装副本的extensions/Interwiki/目录中。
如果您对git熟悉,并且拥有您服务器的shell访问权,您也可以通过以下方法获得扩展:
cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/Interwiki.git
安裝
- 下载文件,并将其放置在您
extensions/
文件夹中的Interwiki
目录内。 - 将下列代码放置在您的
LocalSettings.php
的底部:wfLoadExtension( 'Interwiki' ); // 授予管理员权限以编辑跨维基数据 $wgGroupPermissions['sysop']['interwiki'] = true; // 创建一个可以编辑跨维基数据的新用户组 // (行政员可以将用户添加到该组) # $wgGroupPermissions['developer']['interwiki'] = true; // 如果需要激活上一行命令,删除#
- 完成 – 在您的wiki上导航至Special:Version,以验证已成功安装扩展。
- MediaWiki 自带的配置不会授予任何用户组权限。 因此,您需要自己添加配置,否则没有人能够编辑跨维基数据。
- 要启用来自其他站点的嵌入,您需要启用
$wgEnableScaryTranscluding
。 - 要禁用通过 Special:Interwiki 接口添加前缀,请将
$wgInterwikiViewOnly
设置为true
。
SpecialInterwiki.i18n.php
中每个语言环境定义的 interwiki
消息项定义。 它的值为查看和编辑跨wiki数据。
配置跨语言链接
To set up interlanguage links using this extension, make sure that $wgInterwikiMagic
is set to true
and $wgHideInterlanguageLinks
is set to false
(they are like this by default, you don't need to change them usually).
The $wgInterwikiViewOnly
also needs to be set to false
(which it is by default).
Then go to Special:Interwiki as a user with the ability to edit interwikis. That is controlled by the interwiki
permission, and by default, no user group has this permission, so it needs to be added to a user group with, e.g.
$wgGroupPermissions['sysop']['interwiki'] = true;
Once on Special:Interwiki, you can either click the "Add an interwiki or language prefix" link at the top of the table, or click the "Edit" or "Delete" links in the table row of an existing interwiki prefix.
Choosing to add or edit an interwiki prefix will take you to a separate page with a form with various fields to be filled. The main fields are "name", which is the prefix that would be used for the links, and "URL", where you put the full URL pattern. For example, setting name=foowiki
and URL=http://fr.foowiki.tld/wiki/$1
would make [[foowiki:Blah]]
point to http://fr.foowiki.tld/wiki/Blah.
There are also two checkboxes labeled "Forward" and "Transclude". See Manual:Interwiki table for a full explanation of the forward (iw_local
) and transclude (iw_trans
) bits.
In brief:
- Enabling forwarding ('local' true) is normally done between all languages and projects in the same group, as it allows a link to any one of the languages to be used as a gateway to the others. The English-language Wikipedia, for instance, sets the 'local' bit true for all of the other-language Wikipedias and for projects like commons:, wikinews: or wikivoyage:. A user on a wiki outside Wikipedia where the wikipedia: interwiki prefix points to en.wikipedia.org could create a link like wikipedia:fr:Encyclopédie. That link goes initially to "fr:Encyclopédie" on the English-language Wikipedia. The en.wikipedia server immediately recognises fr: as a 'local' interwiki link, so replies with a redirect to la Wikipédia where fr.wikipedia.org/wiki/Encyclopédie displays the requested French-language Wikipédia page [[Encyclopédie]] et voilà.
- Enabling transclusion is rarely done, as it allows an article on one wiki to use templates from some other wiki. This is referred to as 'scary transclusion' as it will cause problems if the other wiki changes the template unexpectedly. A few wiki farms use this to create one 'central wiki' with various templates which are made available to other wikis in the same farm. If you don't need this, don't enable it.
全域跨维基
Since version 3, Interwiki supports defining a global/central database and pulling defined interwikis from there as well as from the local table. This functions essentially as a table merge, with local interwiki definitions overriding central. Language links are not pulled from the central table; these are set up as local-only due to a central table likely serving more than one project (with each having its own languages).
The central table is the interwiki table of the central wiki. This means that as far as the central wiki is concerned, it is basically just a normal non-global setup. There are therefore no special rights associated with the central (global) table, though it is likely you may want to be more picky about how you assign the 'interwiki' edit right on this wiki.
- This was decided by looking at current possible use cases (ShoutWiki's hub, Uncyclomedia's central wiki, and Meta-Wiki) where the central wiki isn't going to have anything extra anyway.
- This might change in the future, but anything more intelligent will require schema updates.
- This probably doesn't work with table prefixes because of how the table is accessed.
To set up a central interwiki table, simply provide the name of the database of the wiki you want to use:
// To enable pulling global interwikis from a central database
$wgInterwikiCentralDB = 'mw_central';
Replace 'mw_central' with the name of the database.
For those using table prefixes here is an alternative solution for "pool_example_wiki" tables.
$wgSharedDB = 'example_wiki'; # The $wgDBname for the wiki database holding the main interwiki table
$wgSharedPrefix = 'pool_'; # The $wgDBprefix for the database. Defaults to the prefix of the current wiki if not specified
$wgSharedTables = ['interwiki'];
协议相对 URL
You can use protocol-relative URLs (PRURLs), so that users accessing your wiki over either HTTP or HTTPS can uses that same protocol to access interwiki links.
To use a PRURL, first ensure the destination server supports HTTPS; if it does, then simply remove the https:
portion of the URL in the link table.
For example, change
https://en.wikipedia.org/wiki/$1
to:
//en.wikipedia.org/wiki/$1
此扩展用于一个或多个维基媒体项目。 这可能意味着扩展足够稳定、运作足够良好,可以用在这样的高流量的网站上。 请在维基媒体的CommonSettings.php和InitialiseSettings.php配置文件中查找此扩展的名称以查看哪些网站安装了该扩展。 特定wiki上的已安装的扩展的完整列表位于Special:Version页面。 |
此擴充功能包含在以下包或/和wiki農場: 這不是一份權威名單。即使一些wiki農場/託管者沒有被列在這裡,他們也可能包含這個extension。請以各wiki農場/託管者或包的狀態為準。 |