Manual:Extensions/zh

{| {| style="border: 2px solid #aaa; padding: 1em 2em; margin: 1em 0 2em 0; width:auto; margin:0 auto; float: left" |

什么是扩展插件?
扩展插件允许你定制MediaWiki的外观和工作方式. Wiki用户可以浏览现有扩展插件或者请求一个新插件. 系统管理员可在他管理的MediaWiki网站上安装（或删除）扩展插件. 开发者可以编写新插件或者完善已有插件. 根据关键字搜索扩展插件：
 * style="text-align: center; valign: middle; padding: 0 2em" |
 * }
 * style="white-space: nowrap;" |


 * }

安装插件可以实现各人不同的目的：


 * 扩充用于写文章的wiki的标记 - 参阅 Category:Parser function extensions 和 Category:Parser extensions.
 * 添加新的报告或新的管理功能 - 参阅 Category:Special page extensions.
 * 改变MediaWiki的外观和感觉 - 参阅 Gallery of user styles 和 Category:User interface extensions.
 * 定制验证机制提高安全等级 - 参阅 Category:Authentication and Authorization Extensions.

浏览扩展插件
你可浏览Category:Extensions by category（扩展插件的分类）或者Extension Matrix（扩展插件矩阵）以了解已有插件的功能范围. 关于如何安装这些插件或者如何编写自己的插件，参见后续章节.

检查已安装的插件
只有那些具备访问服务器文件系统的管理员可以安装用于MediaWiki的扩展插件，但是任何人都可以点击Special:Version页面获得当前有哪些扩展插件被用在这个MediaWiki网站上的信息. 例如，点击这里可以了解哪些扩展插件被用在了英文维基百科.

安装扩展插件
在安装完MediaWiki后即可安装扩展插件. 添加一个插件需要下面几个步骤：


 * 1) 开始前
 * 少数扩展插件需要安装补丁. 其中大多数提供了专为unix安装命令而设计的使用说明. 这需要命令行权限（SSH）来运行这些在扩展插件帮助页面上给出的命令.
 * 1) 下载扩展插件.
 * Extension Distributor 可帮你选择和下载最受欢迎的扩展插件.
 * 扩展插件通常以模块的程序包形式发布. They generally go in their own subdirectory of .  A list of extensions documented on MediaWiki.org is available on the extension matrix, and a list of extensions stored in the Wikimedia SVN repository is located at svn:trunk/extensions. Some extensions are available as source code within [ this wiki] . You may want to automate copying them.
 * Unofficial bundles of the extensions in the Wikimedia SVN repository can be found on the toolserver. These bundles are arbitrary snapshots, so keep in mind they might contain a broken version of the extension (just as if you load them from the developer's repository directly).
 * 1) 安装扩展插件.
 * 通常, 在 文件的结尾（但应在PHP代码结束符" "之前）添加下列代码：
 * This line forces the PHP interpreter to read the extension file, and thereby make it accessible to MediaWiki.
 * Some extensions can conflict with maintenance scripts, for example if they directly access $_SERVER (not recommended).
 * In this case they can be wrapped in the conditional so maintenance scripts can still run.
 * if (!$wgCommandLineMode) {
 * require_once( "$IP/extensions/extension_name/extension_name.php" );
 * }
 * The maintenance script importDump.php will fail for any extension which requires customized namespaces which is included inside the conditional above such as Extension:Semantic MediaWiki, Extension:Semantic Forms.
 * The maintenance script importDump.php will fail for any extension which requires customized namespaces which is included inside the conditional above such as Extension:Semantic MediaWiki, Extension:Semantic Forms.

升级扩展插件
Some extensions require to be updated whenever you update MediaWiki, while others work with multiple versions. To upgrade to a new version of an extension:
 * 1) Download the new version of the extension
 * 2) Replace all the extension files in the extension/ExtensionName directory with the new files. Do not remove the extension configuration present in LocalSettings.php
 * 3) Depending on the extension, you may have to run the Update.php maintenance script. Most extensions will mention if this script needs to be run or not. (Running the update.php script when its unnecessary will not hurt anything, so if you're unsure don't be afraid to run it). If you don't have command line access, you can also use the web updater.
 * 4) That's all you need to do. In most cases any extension configuration you have in LocalSettings.php will also work with the newer version of the extension.

卸载扩展插件
Extensions are added by adding a line to LocalSettings.php, which basically looks like this:


 * 1) Remove this line and the extension is uninstalled. If you want to, you can (and if you do not want to use this extension in the future you should) remove the files of this extension inside the folder "extensions/".
 * 2) Maybe you also have some other lines in LocalSettings.php, which have to do with the extension you want to remove. Most likely this will be lines, which give certain users the right to access pages, which are provided by the extension. These lines contain the variable "$wgGroupPermissions" and make some settings there. As far as they have to do with rights, which come from the removed extension, you can remove these lines as well.
 * 3) Maybe your extension also has added columns to your database. The updater maintenance/update.php removes them, when you run it, after you have uninstalled the extension.

开发扩展插件
This complex topic is handled on under the developing extensions manual page.

另请参阅

 * Extension Matrix
 * Category:Extensions
 * Category:Extensions in need of a new maintainer
 * Template:Extension
 * Manual:Developing extensions
 * Manual:Parser functions
 * Manual:Special pages
 * Manual:Tag extensions
 * Project:Extension requests
 * Manual:Translating extensions - Information about translating extensions.
 * m:Category:MediaWiki extensions - in the process of being moved to MediaWiki.org.