Manual:FAQ/zh



MediaWiki, Wikimedia(维基媒体基金会), Wikipedia(维基百科)和wiki间的区别是什么?
这个问题经常被问到,请参阅Wikipedia、Wikimedia、MediaWiki 和 wiki 的区别页面获得更详细的答案.

我能将MediaWiki用于某个用途么?
MediaWiki是自由软件,这意味着你可以以任意方式使用它而不需要法律上的许可. Furthermore, its licensing conditions apply solely to the software itself. This means that although many wikis license their content under a permissive license, you are not obliged to license the content submitted to your wiki in any particular way. 当然,作为支持维基百科运行的软件而发展起来的项目,我们鼓励你使用一个自由许可证授权你的wiki上的内容,但是这不是必须的.

如果你希望修改MediaWiki软件,没有问题!但是这里有一些限制,查看GNU 通用公共许可证第二版的全文了解详细信息. 因为MediaWiki是免费使用的，在适用的法律允许的范围内没有担保责任.

到哪里里下载MediaWiki?
点击这里前往下载页.你会下载到一个.tar.gz归档文件. 你也可以 通过Git从我们的版本库中下载.

如何安装MediaWiki?
安装MediaWiki的预计时间为10到30分钟,包括上传与复制文件,和运行设置脚本. 请参阅安装指南,你也可以在那里找到系统需求.

能通过软件包管理器安装MediaWiki吗?
大部分Linux发行版都会以分发包的格式提供MediaWiki软件. MediaWiki开发团队认为您应该向您的Linux发行版提供者咨询安装与配置的事宜. 负责维护这些分发包的独立社群和公司应该向您提供安装指南.

但是请注意因为软件源中的MediaWiki可能不是最新的，所以请密切关注你所使用的扩展的兼容性.


 * 另请参阅: MediaWiki软件套装（英文）

我能在一个服务器上运行多个MediaWiki网站吗?
只要满足下列条件，您就可以在一台服务器上安装多个wiki：

或者
 * 您的每一个wiki使用各自不同的数据库
 * 您的每一个wiki的数据库前缀不相同（如果您用的是PostgreSQL，在不同的模式或用户下，也能达到这一效果）

要了解这些选项的相关信息，可分别参见$wgDBname与$wgDBprefix.

要了解设置wiki家族的相关信息，可参见Manual:Wiki家族.

要了解将多个wiki设置为使用相同服务器、数据库与资源的其他方法，参见来自Steve Rumberg（存档）用户的更深层的解释与进一步的意见.

MediaWiki能在安全模式下工作吗?
可以，但其功能会受到一定限制. 参见安全模式.

MediaWiki需要Shell访问吗?
终端访问（SSH访问）在安装MediaWiki的过程中并不是必须的，但我们强烈推荐你这么做. 如果不能进行终端访问，您可能难以对您的wiki进行备份，或难以将它升级到更新的版本. 如果完全脱离终端访问，您将不能完成一些维护任务. Many major extensions work best with shell access.

如何安装扩展?
参见Manual:Extensions获取安装插件与编写插件的相关信息. 见Category:插件以寻找已有的插件.

如何添加额外的名字空间?
参阅Creating a custom namespace.

如何启用文件上传?
文件上传是MediaWiki常用的功能之一，但在目前所有的发行版中都被默认关闭了. 要启用它们，首先要让网站服务器上的上传文件夹（默认为 ）可被写入（chmod 777或允许Apache用户写入内容，等等），然后在LocalSettings.php中将$wgEnableUploads设为 值（例如“$wgEnableUploads = true;”）. 如果你在上传时遇到了一个"failed to mkdir" （无法创建文件夹）错误，你可能需要调整你的服务器上的文件权限.


 * 也请参阅：Manual:Configuring file uploads

如何在MediaWiki中显示数学公式?
MediaWiki允许用户插入数学公式. 参见Manual:Math获取安装指南.

如何设置我的Wiki的时区?

 * 请参阅： Manual:Timezone

如何强制刷新一个缓存页面?
有时您需要刷新被缓存的页面，比如当页面的导航栏发生了变化后. 在页面的动态URL后加上 即可.

例如：http://www.mediawiki.org/w/index.php?title=Main_Page&action=purge

或在页面的短型URL后加上 ：

例如：http://www.mediawiki.org/wiki/Main_Page?action=purge


 * 也请参阅：Manual:Purge, Manual:Parameters to index.php.

如何完全停用缓存?
将下列语句加入LocalSettings.php即可： $wgEnableParserCache = false; $wgCachePages = false;

如何允许上传其他格式的文件?
MediaWiki 使用$wgFileExtensions来限定允许上传的文件格式. 例如,要允许用户上传PDF格式文件,请将下面一行增加到你的LocalSettings.php中:

例如,要允许用户上传PDF格式文件,请将下面一行增加到你的LocalSettings.php中:

可以像下面这样一次添加多个文件类型:


 * 也请参阅：Special:MyLanguage/Manual:Configuring file uploads

"文件已损坏或者扩展名不正确"
有些用户报告说，在向已允许扩展名列表中增加文件格式后，软件会发生错误. 出错后的文字类似于下方：


 * 文件已损坏或存在无效扩展名. 请重新检查并上传文件. 

可能的解决方案：


 * 设定$wgMimeDetectorCommand的值，例如：在Unix或Linux，您可以将它设为 :
 * 编译／安装PHP插件fileinfo
 * Fedora - yum install php-pecl-Fileinfo
 * Fedora - yum install php-pecl-Fileinfo


 * 也请参阅：Manual:Mime type detection.code>

安装程序没创建一个管理员用户?
有时可能因为安装程序没有成功运行或是用户表丢失的缘故导致没有管理员账户, 这里有几个修复的方法:

maintenance/createAndPromote.php

 * 对于1.16以前版本的MediaWiki,确保 配置正确(参阅 )
 * 在shell中运行  . 要让新创建的用户既成为管理员又成为行政员,加入  参数.

这会创建一个新用户并授予管理员权限, 运行  获得帮助.

在数据库中修改

 * 用一般方法注册一个账户 (Special:UserLogin).
 * 在 Special:Preferences 中查看用户ID.
 * 在数据库中执行下列SQL语句:
 * 用你刚刚查阅的用户ID替换.
 * 注意: 如果LocalSettings.php中定义了  ,记得加在表名前. 例如   = "XYZ"时的表名是.
 * 注意: 如果LocalSettings.php中定义了  ,记得加在表名前. 例如   = "XYZ"时的表名是.

临时允许任何人修改用户权限,然后给初始化时创建的用户分配权限
为了能修改用户权限,这个操作的关键是允许所有用户修改权限.
 * 用一般方法注册一个账户 (Special:UserLogin), 然后登录.
 * 在LocalSettings.php中加入下面一行
 * 在 special:userrights中将新创建的用户添加到管理员与行政员组.
 * Remove the  line from your LocalSettings.php . This step is very important, as until you remove it anyone can alter permissions, which is bad.
 * Remove the  line from your LocalSettings.php . This step is very important, as until you remove it anyone can alter permissions, which is bad.

如何重置密码?

 * 参阅 Manual:Resetting passwords

如何创建或修改跨wiki链接?

 * 参阅 Manual:Interwiki

如何让显示的URL更短?
(例如用 /wiki/Article_Name as opposed to /w/index.php?title=Article_Name)
 * 参阅 Manual:Short URL

我能像目录一样组织页面吗,像/wiki/subdir/PageName这样?

 * 参阅 Manual:$wgNamespacesWithSubpages, Help:Subpages

下载和使用MediaWiki是免费的吗?
是的，在自由软件意义下的自由. 参见Project:Copyrights了解本站已有内容在许可协议方面的问题.

如何管理用户权限?
 参见Manual:用户权限与Manual:用户权限管理获取常见的信息. 参见Manual:访问控制获取限制访问的方法与措施.

如何阻止匿名用户编辑页面?
建议修改. 添加下面一行到 :

通过Extension:AbuseFilter,管理员可以临时阻止匿名编辑.


 * 也请参阅：阻止访问, Manual:User rights.

如何阻止匿名用户创建页面?
也请参阅 Manual:$wgWhitelistRead. 参阅Manual:Preventing access for more information.
 * 添加下面一行到 的最下面:

如何阻止创建账户?
参阅Manual:Preventing access for more information.
 * 添加下面一行到 的最下面:

如何在注册时要求提供电子邮件地址?

 * 参阅Manual:$wgEmailConfirmToEdit

如何让MediaWiki只读?

 * 参阅Manual:$wgReadOnly

如何修改默认的用户设置?
MediaWiki 将默认的用户选项保存在语言文件中,例如. 但是和DefaultSettings.php一样,别修改它,做参考就好.

查找你要修改的选项 在Language.php,例如:

要改成50的话,在LocalSettings.php里添加: 注意是设置$wgDefaultUserOptions,而不是$wgDefaultUserOptionsEn. Any settings in $wgDefaultUserOptions will override those set in the language file.

要改变默认搜索的名字空间,在LocalSettings.php里设置$wgNamespacesToBeSearchedDefault. 例如要默认搜索主名字空间和分类名字空间:

$wgNamespacesToBeSearchedDefault = array(    NS_MAIN => true,     NS_CATEGORY => true, );

某些情况下,你在改变默认设置后希望改变现有用户的设置.

要这样做的话,在maintaince目录运行userOptions.php. 第一次运行建议加入 "--dry" 参数（这个参数用来模拟运行，不会修改数据库. ）.

php userOptions.php --dry --nowarn searchlimit --old 20 --new 50

另外，在进行实际操作前建议备份数据库.


 * ''也请参阅：Manual:$wgDefaultUserOptions

如何优化MediaWiki的运行速度?

 * 请参阅： Manual:Performance tuning

如何启用搜索建议?

 * 请参阅： Manual:Enabling autocomplete in search box

升级

 * 请参阅： Manual:Upgrading

能把我的wiki移动到另一台电脑上吗?
Yes. 应该可以, 实质上就是备份你的安装然后"还原"到一台新电脑上. 然后对配置进行一些适当的调整以适合新服务器的需要.

那么,如何做?
参阅 Manual:Moving a wiki.

如何修改左上角的标志?
左上角的标志是由LocalSettings.php中的$wgLogo选项决定.

有两个方法可以修改:


 * 1) 通过标准上传界面向你的wiki上传一张图片, 这样以后修改起来也容易,所以你可能希望保护它防止被篡改.
 * 向LocalSettings.php添加$wgLogo参数, 例如:
 * 1) 或者向服务器直接上传一张图片.
 * 向LocalSettings.php添加$wgLogo参数, 例如:
 * (这个例子中图片和LocalSettings.php在一个文件夹中.)
 * (这个例子中图片和LocalSettings.php在一个文件夹中.)
 * (这个例子中图片和LocalSettings.php在一个文件夹中.)

要改变某些页面的标志,覆盖#p-logo的background-image属性,或者使用像Extension:LogoFunctions这样的扩展.

如何编辑wiki的CSS?
别直接编辑像main.css一类的CSS文件,因为这样会使你日后的升级变得困难. 要改变全站的样式,编辑MediaWiki:Common.css,要改变特定皮肤的样式(例如Monobook),编辑MediaWiki:Monobook.css.这些页面的内容会覆盖main.css中的值.

The content of MediaWiki:Common.css and MediaWiki:Monobook.css pages always override the default CSS styles specified in main.css.

如何隐藏左侧的导航栏
换句话说,你希望内容占据全部的宽度来隐藏logo和左侧导航?

要隐藏它们,将下面的代码添加到MediaWiki:Common.css中.

要只在用户按下F11时隐藏,将下面的代码添加到 MediaWiki:Common.js:

如何隐藏页面底部的分类列表?
添加这一行到你wiki的MediaWiki:Common.css中

我能自定义左侧顶部的标志吗,如果可以的话,怎样做?
The logo is a portlet block without a pBody section. It is identified by the p-logo id. The background image is specified by the $wgLogo variable, which is defined in DefaultSettings.php. This location is relative to the web server root and not the system root. Redefine this in LocalSettings.php to change the image. If set wrong there will be no image on the page; check your web server error log and adjust accordingly. However the size of the p-logo will need to be big enough for the logo if it is not to be clipped. This is set in the stylesheet (main.css in Monobook), under the p-logo style, the default setting is:

Note, if you are using a different sized logo, and want to change the CSS, please do not modify any of the core MediaWiki stylesheets. Instead add to the on-wiki css page (MediaWiki:Monobook.css for monobook, MediaWiki:Vector.css for vector. MediaWiki:Common.css will also work for all skins)

如何改变点击左上角的标志后跳转到的页面?
默认情况下点击logo会返回到首页,要指定哪一个页面是首页,编辑MediaWiki:Mainpage. 要在点击logo时前往任意的其他页面(不一定是你的wiki),你可以向LocalSettings.php中增加一个hook来覆盖默认设置.

To make the link of the site-logo link externally to any other arbitrary URL, you can add a hook to your LocalSettings.php to override the mainpage href which is used by the logo.

改变标志的大小
Note that a tag is on top of the logo so if you are trying to reduce the size of the logo's portlet you will also need to change the #p-logo a and #p-logo a:hover rules. The default setting for these is:

如何改变地址栏的图标 (favicon)?

 * 把favicon.ico上传到你的服务器的根目录.
 * 或者编辑LocalSettings.php中的$wgFavicon,增加

参阅Manual:$wgFavicon获得更多细节.

提示: favicon 的大小应为16x16 / 32x32 像素.

Rewrite 规则
如果你有用URL重写规则从URL中移除"index.php",你也需要为.ico加个例外.把下面一行加入到.htaccess中: 把下面一行加入到.htaccess中:


 * RewriteRule .*\.ico$ - [L]

这个规则必须在index.php的规则之前.

注意区分大小写
记得favicon.ico的文件名全是小写("favicon.ico",而不是"Favicon.ico"). 大多数的服务器(例如类UNIX系统)可能找不到有大写的文件名.

如何定义导航栏?
使用Monobook皮肤的每一个页面左边是导航条，其内容由您的wiki上的MediaWiki:Sidebar 页面决定. 定制这些内容的相关信息，请参看Manual:Interface/Sidebar.

如何在每一个页面上放置一个消息(站点通告)?
在MediaWiki:Sitenotice放置一些文本.内容会显示在所有的页面上方.

你也可以在MediaWiki:Anonnotice上放置一些文本,当用户未登录时会出现在页面的上方. It is often a good idea to transclude the site notice on the anon notice to make sure that logged-out users still get the information on the site notice,

如何指定首页?
默认的首页名称为"首页".编辑MediaWiki:Mainpage来改变. This can be changed by altering the contents of  MediaWiki:Mainpage to point to a different title.

有时边栏中的"首页"链接可能没有改变,这时需要编辑 MediaWiki:Sidebar.

如何改变首页的标题?
用移动页面选项移动首页即可.

通常你可能期望指定哪个页面是首页.

如何在首页隐藏标题?
MediaWiki默认没有隐藏首页标题的功能(参阅),你可以用CSS 或者NoTitle extension完成.

将下面一行添加到你wiki上的中:

如果你的MediaWiki版本非常旧,或是你移动了首页却没更新MediaWiki:Mainpage,或是某些不支持这项设定的皮肤上,这可能无法工作

如果你的皮肤不是使用 标签和 类选择器的话,你需要自行调整.

如何隐藏目录?
目录 (TOC) 会在大于四个标题的页面上显示, 当然也有办法隐藏.


 * ==== 某个页面 ====
 * 把魔术字  放在页面上.


 * 所有页面
 * 用 NoTOC扩展
 * 或者
 * 添加 到MediaWiki:Common.css.


 * 单个用户
 * 用户可以把同样的规则添加到用户样式表中(例如 common.css).


 * 参数设置中曾经有一个参数可以隐藏目录,这个功能在MediaWiki1.23中被移除了. (T54813).

如何改变界面文字?
Interface text is altered using the MediaWiki namespace. For each deviation from the default in the site language there is a page MediaWiki:Englishmessagename, and for each deviation from the default in each other language a page MediaWiki:Englishmessagename/languagecode. (Since release 1.9 there are no pages for messages equal to the default.). On creation of a page the edit box autofills with the default. When creating a page to override the default it is useful to first save the default version, to allow diffs with it. See also Manual:System message.


 * Special:Allmessages提供了一个系统消息的列表,通过编辑对应的消息文字可以进行修改.
 * 要关闭MediaWiki名字空间, 使用 $wgUseDatabaseMessages设置.
 * 要移除页面底部的隐私政策或者免责声明,用 替换 MediaWiki:Privacy 或 MediaWiki:Disclaimers 的内容.

如何改变界面文字语言?
要改变默认的界面的语言,在 改变 的值,例如:

你也许需要绕过浏览器缓存来查看更改.

新的默认值会对没有更改过这项设置的用户生效.

Extension:UniversalLanguageSelector提供了一种让用户自行选择显示语言的方法,Extension:Translate可以让用户翻译wiki上的内容为其他语言.

如何去除某个标签(例如"文章"或"编辑")?
请参阅： User:Subfader/Hide_page_tabs多获得些功能.

添加下一行到MediaWiki:Common.css中:

查看源代码来知道要移除的标签的选择器ID.

注意: 这个设置只会在Monobook(或其分支,例如Vector)皮肤上工作,它也不会阻止用户编辑, 参阅Manual:User rights来获得阻止用户编辑的方法.

如何增加一个标签?
旧版本的MediaWiki可以通过Extension:DynamicTabs来实现 (也可以通过Manual:Hooks/SkinTemplateNavigation编写自己的扩展):

下面的实例会移除讨论标签并 添加一个回到首页的标签,假设它叫做 :

然后把下面一行添加到LocalSettings.php中: to the bottom of LocalSettings.php

如何去除某个页面上的某个标签?
编辑MediaWiki:Common.css,下面的例子会移除首页上的讨论标签:

To modify MediaWiki:Common.css you must have administrative privileges.


 * 也请参阅：Manual:Hide page tabs

去除所有页面上的某一个标签
编辑MediaWiki:Common.css,下面的例子会移除所有页面上的讨论标签:

其他的标签id还有 #ca-history, #ca-viewsource, #ca-view (条目), #ca-nstab-main (首页), #ca-viewsource.

下拉菜单里的标签id有 #ca-watch, #ca-move, #ca-delete.

To modify MediaWiki:Common.css you must have administrative privileges.

如何对匿名用户隐藏"编辑段落"链接?
改变的值可以实现,

编辑,加入下面一行:


 * 另参阅

如果 $wgDisableAnonTalk为真,如何去除"关于此IP地址的讨论"按钮?
设置 $wgShowIPinHeader 为 false.

如何移除"登录/创建账户"链接?
向添加下面的代码可以从个人工具栏中移除"登录/创建账户"链接:

如何限制某些操作和访问特殊页面?

 * 注意: MediaWiki 不是为这种用法设计的! It should be noted that the following 'answer' is a hack that only 'works' with the Apache webserver. Note also that this system is not foolproof, it's just one step further than hiding the links (see above).

Suppressing actions and special pages can be useful when you want to create the illusion of a static website via a particular URL or VirtualHost, but also have an 'internal' view that is a true wiki. i.e. if you have an inward facing 'view' of your wiki that users can edit, and an outward facing 'view' that should appear like a static website (no history, no discussion, etc., etc.).

After hiding all the appropriate links (see above), if you are using the Apache web server, you can disable actions and special pages using the following rewrite rules:


 * 1) Lock down the site (disable MediaWiki commands)

RewriteEngine On


 * 1) RewriteLog /tmp/rewrite.log


 * 1) RewriteLogLevel 9


 * 1) See http://www.mediawiki.org/wiki/Manual:Parameters_to_index.php#Actions

RewriteCond %{QUERY_STRING} (.*action=.*) RewriteRule .* http://www.my.domain.com?

RewriteCond %{REQUEST_URI} !^/index.php/Special:Search RewriteCond %{REQUEST_URI} ^(.*Special:.*) RewriteRule .* http://www.my.domain.com?

RewriteCond %{QUERY_STRING} ^(.*Special:.*) RewriteRule .* http://www.my.domain.com?
 * 1) Catch a trick...

Above, a request for, for example, will be simply rewritten to. Similarly any page in the Special namespace (with the exception of Special:Search) will be rewritten to. Remember, this is only a hack, and isn't intended as a solution for a secure CMS.

Note that you will need to adjust the above rules to match your specific URL naming schema.

Other issues to consider when trying to lock down a site like this is the API and POST requests for the wiki content (rather than GET).

如何编辑系统消息?
Special:Allmessages包含系统消息的列表,可以编辑.

如何改变页脚?

 * 参阅Manual:Footer and Manual:Configuration settings

如何移除页脚中的"Powered by MediaWiki"图像?
编辑MediaWiki:Common.css:

对于Vector皮肤:

对于1.17版的Vector皮肤:

对于1.18版的Vector皮肤:

在1.17版本中,可以把下面一行添加到中来完全移除Powered by MediaWiki图像:

对于1.16及以前的版本,你需要使用hooks:

参阅获得关于自定页脚图标的更多信息..

如何自订签名消息(例如增加一个回复链接)?
编辑MediaWiki:Signature(用户) 或 MediaWiki:Signature-anon(匿名用户).

例如  会放置一个讨论页链接,   会放置一个直接增加新段落的链接.

用户可以通过参数设置自定义自己的签名.

能改变标题吗,怎样做?
大部分你希望更改的内容可以在MediaWiki名字空间中找到,

前往Special:AllMessages并搜索你希望更改的文字获得页面的位置,要编辑的 话还需要管理员权限.

要改变在浏览器标题栏中显示的标题,编辑MediaWiki:Pagetitle. Go there and edit it just like you would any other page in your wiki.

在最近的MediaWiki版本中,默认的设置为MediaWiki:Pagetitle is $1 -.

If $wgSitename is correct in LocalSettings.php but is still wrong, it may be that you're using a user-contributed language file which incorrectly sets $wgSitename to a transliteration of "Wikipedia". Edit the language file to correct this. For example, the Hebrew language file is at  in your wiki directory.

记得在改变后清除你的浏览器缓存来查看改变.

MediaWiki能自动首字母大写$wgSitename吗?
可以, 在LocalSettings.php中改变 $wgCapitalLinks 设置即可.

如何在新窗口打开外部链接?

 * 参阅Manual:Opening external links in a new window

我能阻止MediaWiki格式化文本吗?
用"  "标记包围不希望格式化的文本即可.

例子: svn co http://svn.example.com/myproject/

结果: svn co http://svn.example.com/myproject/

如何强制用户先预览再提交编辑?

 * 请参阅： Manual:Force preview 和 Extension:ForcePreview

如何在编辑页面上增加更多按钮?

 * 请参阅： Manual:Custom edit buttons

如何在编辑器中增加插入字符的链接?
安装并配置Extension:CharInsert.

如何在自己的wiki上使用维基百科的默认皮肤(Vector)?
推出于 1.16版本,在1.17版本中为默认皮肤. 参阅Manual:$wgDefaultSkin 来设置你wiki的默认皮肤.

安装Vector扩展来实现更多功能.

如何在显示打印版本时不显示外部链接?
将下面的代码添加到你的wiki上的MediaWiki:Print.css中:

This will override the styles defined in skins/common/commonPrint.css in MediaWiki source code. For more information, see Manual:CSS.

或者你希望在打印版本中为外部链接加下划线:

如何改变首页上的标签的名称?
编辑" ".

记得清除缓存来查看结果. Don't forget to save the page as well.

如何编辑页面?
To edit a page, simply click the edit link that appears on each page. Using the default Vector skin, this is in the form of a tab at the top of the page. A form will appear, containing the existing markup. When you have finished making modifications, click the Save button to commit your changes.


 * 参阅：MyLanguage/Help:Editing pages

如何创建一个页面?
有几个方法创建一个新页面:

在某些wiki上,失败的搜索中会包含创建页面的链接.
 * 创建一个指向它的内部链接,然后点击它.
 * 转到你希望创建的页面,例如  ,然后点击"创建" 或 "创建源代码" 链接.


 * 也请参阅：MyLanguage/Help:Starting a new page

能删除一个旧版本的页面吗?
旧版本会为了方便复查或回退更改而保留在数据库中, 不过管理员可能会因为法律原因或为了减少数据库占用的空间而希望删除某些版本.


 * 管理员可以删除整个页面再回=恢复某些版本
 * Oversight (也称作HideRevision) 扩展可以用来去除指定的修订历史.(MediaWiki <1.16).
 * 新版的 MediaWikis (1.14+)中,可以启用RevisionDelete(修订版本删除)功能来允许有权限的用户从编辑历史中移除一个版本.
 * 维护脚本 可以进行大量删除修订版本.


 * 也请参阅：Manual:Removing embarrassment

如何删除某个页面的某些版本?

 * 请参阅： RevisionDelete

或者你可以删除整个页面再恢复你需要的版本.

有没有一个编辑教程?
这里和维基媒体计划上有些教程可以参考: There are also markup references, etc. available on Meta.


 * 本网站上的 Help:Editing pages
 * Meta上的 Editing
 * 英文维基百科上的 How to edit a page

如何查看某个页面的打印版本?
MediaWiki内置了一套用于打印的css样式表,你可以在你的浏览器中打开打印预览窗口来查看.

或者你可以使用边栏的打印版本链接(如果启用了Collection扩展,则是打印/导出).

如何使用模板?

 * 参阅Help:Templates

我能使用维基共享资源上的多媒体文件吗?
是的,鼓励你通过设置$wgUseInstantCommons来使用.


 * '也请参阅：InstantCommons''

如使用一个模板作为签名?
When you look at your preferences, you see a check box for "raw signature." But the field will only take a certain number of characters. What if you want more?

You will need to create two pages, possibly in your userspace.


 * 1) 建立一个页面来包含你的签名(例如User:Example/sign)
 * 2) 打开参数设置,在参数设置的“您的昵称（签名时用）”字段，填入“”，并且勾选“将签名视为维基文本（不自动生成链接）”.   保存你的参数设置.
 * 3) Create a second page (SECOND PAGE) (possibly a sub-page of the first)
 * 4) Go back to the first page (FIRST PAGE) and do
 * 5) Go to the second page (SECOND PAGE) and place the code you wish to have for your signature.

If you don't have this structure, you will still be inserting all your signature code into the raw code wherever your signature is used, because the software will insert "SUBST" in your preferences. You may not mind this, in which case you only need one page. If you want the raw code to only display, which looks a lot cleaner, then you need to use the two-page structure.

如何加入沙盒功能?
大多数情况下,沙盒是一个任何用户可以编辑的页面. 这只是个你可以自由决定的普通页面,MediaWiki并没有这种核心功能. 你也许注意到维基百科上的沙盒像是自动清空的,但这不完全对.

清空沙盒是由用户(或是机器人)定时完成的. This is not quite correct; there are a number of volunteers who run bots to clean these up and return them to a certain state at regular time intervals.

如何在个人工具栏(右上角)加入一个沙盒链接?
安装并启用Gadget扩展并添加沙盒插件. 你也许希望对所有用户默认启用.

如何运行一个多语言wiki?
要让你的wiki提供工具进行翻译和自定义界面文字,可以使用翻译扩展,文档在这.

从MediaWiki XML 转储中导入

 * 参阅Manual:Importing XML dumps

从其他wiki软件迁移
Note: The following is directly copied from old meta FAQ. It might need to be corrected.

There is some documentation about importing in the UPGRADE file distributed with MediaWiki.

To follow on from those, this is how at least one individual imported pages from usemod to MediaWiki:

Because MediaWiki does not automatically link to CamelCase style links, you will need to add brackets  to all your links. You can do this with the following:

First, obtain ImportStage1.txt (or whatever you want to call it) from the importUseModWiki.php script ( use > to pipe the output to a file )

Second, do

sed '/Importing/!s/\ [A-Z]\w*[a-z]\w*[A-Z]\w*[a-zA-Z]/\ \[\[&\]\] /g' ImportStage1.txt > ImportStage2.txt

This should create proper links in place of your CamelCase links.

This doesn't work so well for SubPage links - someone care to fix?

Then,

sed 's/upload\:\w*\.\w*/http\:\/\/aberwiki\.org\/uploads\/& /g' ImportStage2.txt > ImportStage3.txt

This fixes your upload links. Change the replace text so it fills in your url such as http://www.yourwiki.org/uploads/filename

You are now ready to import ImportStage3.txt into your database with a command such as

mysql -u -p < ImportStage3.txt

Note: If your  outputs an XML file instead of SQL statements, this probably means you have a rather new version of MediaWiki. In such a case, you can import the XML file -- see Importing a Wikipedia database dump into MediaWiki, towards the bottom of the page ('Import XML'). Don't forget to rebuild all the tables -- that page also explains how to do that.

从其他类型文件中导入
有多种可以帮助将HTML或者其他标记语言转化成MediaWiki标记的工具.


 * 开发者和系统管理员工具
 * HTML::WikiConverter::MediaWiki - 一个转换HTML成MediaWiki标记的perl模块.
 * Wikificator -转换XHTML至MediaWiki标记的JavaScript工具.
 * The Edit.php, importImages.php和ImportTextFile.php 维护脚本可以用来导入文本和图像.


 * 用户工具
 * HTML to Wiki Converter - an online HTML to MediaWiki markup conversion service. (Based on HTML::WikiConverter::MediaWiki)
 * wikEd - a text editor for MediaWiki that can import HTML (including Microsoft Word-generated HTML.)


 * 指南
 * Brief notes on converting from Microsoft .chm help files to MediaWiki
 * Notes on converting from Microsoft Office formats to MediaWiki

MediaWiki自动导入脚本
Taken from wiki_import - MediaWiki auto import script:

描述
The script is designed to import a whole folder of files into MediaWiki, with the folder directory tree mapped as wiki category hierarchy.

功能

 * economic, build wiki site from existing knowledge base collection without "double-entry"
 * persistent, map folder directory tree as wiki category hierarchy
 * sophisticated, import/handle all well-known file types automatically
 * complete, cover every applicable scenario, even the case when you need to control access to individual wiki pages
 * versatile, highly customizable

快速参考
wiki_import.sh $ $Revision: 1.1 $

mediawiki automatic file import script

Usage: wiki_import.sh [OPTIONS]...

The script is designed to import a whole folder of files into mediawiki, with the folder directory tree mapped as wiki category hierarchy.

The specification of the file-to-import is passed from standard input.

Options: -s, --sect=n    the root category section of the wiki of the imported article (mandatory) -1, --header    include standard header (category hierarchy path & notice) -l, --link      link to actual file on the web site -f, --footer    include standard footer (article category) -R, --res[=p]   add restricted tag in the footer as '' (default=`$_opt_sect')

Configuration Options: -p, --php=fn    mediawiki import php script specification -r, --root=n    the root category name for the whole wiki site -m, --max=n     max_allowed_packet for mysqld to import -u, --user=n    wiki user used for the import -a, --arch=p    the root url that linked-to archive files based on

Examples:

echo ./path/to/file.ext | wiki_import.sh -1 -l -f -s 'Customer Support' -R

For the rest of details, check out wiki_import.

从其他网站(例如维基百科)导入的模板不工作
你需要安装一些在导出源wiki上使用的扩展,比如ParserFunctions和Cite. 同时确定你复制了需要的CSS和JavaScript.

如何让多个wiki使用一个凭据登录?
如果你正在分割一个wiki为多个,可以使用$wgSharedDB和$wgSharedTables来让不同的wiki使用同一个用户数据库. 你也可以共享那些不依赖于未共享的表或是特定于某个子wiki的表, 参阅Manual:Shared database获得示例和更多信息.
 * If your wikis are already established and you want to switch to a single sign-on, you can use the CentralAuth extension. It has a few more features than a shared user table, but it's more difficult to configure and it's tailored toward a Wikimedia-style setup. However, it is easier than attempting to completely merge multiple user tables into one.

如何允许HTML标签?
参阅Manual:$wgRawHtml ,Manual:$wgGroupPermissions 和 Manual:Preventing access.

也请参阅Extension:SecureHTML 和 Extension:HTMLets,这些方法可以让你更安全的插入HTML.

如何为MediaWiki增加新功能或是修复bug?
改进 (换句话说, 黑掉)MediaWiki的几个基本步骤是:


 * 安装Git
 * 从Git克隆MediaWiki源码.
 * 在你的电脑上运行web服务器,PHP和数据库服务器 (设置它们让你窝火? 遇到问题就求救呗~)
 * 在你的电脑上运行MediaWiki (同样让你窝火? 方法同上)
 * 修复问题或是增加你期望的新功能，没啥想法？从 "修复那些恼人的bug"开始呗.
 * 编辑源代码和相关的文件
 * 接着看Gerrit/Tutorial

如何运行一个机器人?

 * 参阅Manual:Bots

或许可以试试Pywikibot框架.

如何设置 noindex nofollow
在LocalSettings.php中添加.

如何设置一个小型wiki 农场?

 * 请参阅： Manual:Wiki family

如何添加meta标签?
OutputPage类包含一个用来添加meta标签的addMeta方法. The RequestContext can be used to get the relevant OutputPage object.

To add further Meta tags just add further lines as last lines of the function addMetaTags like:

$out->addMeta ( 'description', 'This is a meta description.' );

…帮助名字空间是空的?
现在帮助名字空间默认是空的. 是在你的wiki上还是MediaWiki.org上提供帮助由你决定. Obviously you can easily link your visitors to help resources elsewhere.

现在我们还没有一个清除明了,国际化而且自由的文档. 不过希望复制一些帮助信息到你的网站?没问题!Help:Contents 中的内容在基于MediaWiki搭建的网站上应该都可以使用,而且没有授权问题. 参阅Project:PD help,更多的帮助可以在元维基上的"MediaWiki Handbook"中找到.

…升级后某些图像无法显示?
有些用户报告说在升级后无法显示某些图片, 它们被服务器报告说"MIME类型无效"或"可能有害".

可以在终端运行 来在数据库中设置新的MIME类型.

…png格式的图片没有缩略图?
有时升级了PHP版本以后MimeMagic.php函数的工作方式发生了变化,或者内置函数mime_content_type无法识别PNG格式, 试着在web上搜索mime_content_type png获得关于如何修复它们的信息.

参阅here 获得更多信息.

…搜索一个wiki内容中的关键字却没有结果?
By default, MediaWiki uses MyISAM's fulltext matching functionality to allow searching page content. The default settings for this mean that words of less than four characters won't be indexed, so will be ignored in searches with older versions of MediaWiki.

MediaWiki 1.13 and earlier are unable to work around this; you must either change MySQL's configuration to index shorter words, or upgrade to a more recent version of MediaWiki.

Note that some particular words may still not be indexed if they are in MySQL's default stopword list.

…不能下载MediaWiki1.27?
MediaWiki 0000 是在开发中的版本, 如果你想尝试的话,你可以从Git下载, 或者通过 下载最新的Tarball.

…某个在维基百科中的功能没法在我的wiki上工作?
维基百科(或是Wikimedia的其他网站)运行的是MediaWiki的开发版本(现在是),这意味着某些功能可能与现在的稳定版并不一致. Coupled with the use of several extensions, this means that functionality between these wikis and your particular setup may differ.


 * 参阅Download from Git获得关于下载开发版本的更多信息.
 * To check what version a Wikimedia wiki is running, as well as what extensions are installed, visit the Special:Version page for that wiki

…do I get a 403 Forbidden error after setting permissions on my Fedora system?
Fedora Core enables SELinux by default. Instructions for setting SELinux permissions for MediaWiki are available.

…do I get logged out constantly?
This is probably related to cookies or session data, for example a problem with PHP's session.save_path setting. See Log in problems for information.

…doesn't my wiki work on Sourceforge?

 * See Manual:Installing MediaWiki on SourceForge.net.

…is it a good idea to keep user accounts?
At many times you just want to remove a user account out of the wiki either because it belonged to a spammer account or you just feel like it. The appropriate choice is to block the account or rename it if needed. Here is why:

Do I just remove his row from the User table?

Rob Church posted the following regarding this issue on the mediawiki-l mailing list:

"If the user has made edits, then removing rows from the user table cause theoretical loss of referential integrity. Now, to be honest with you, I can't think of any conditions where this would cause an actual problem; "undefined behaviour" is the phrase we use.

What I'd suggest doing, to be on the safe side, is running a couple of quick updates against the database:



What this will do is cause MediaWiki to treat the revisions as having been made anonymously when generating things like page histories, which should eliminate any problems caused by these routines attempting to check user details from other tables.

If the user has caused log entries, i.e. rows in the logging table, or uploaded images, then the situation becomes trickier, as you'll have to start mopping up all the rows everywhere and it could become a bit of a mess, so if the user's done anything other than edit, I would strongly recommend just blocking them indefinitely.

If the username is offensive or undesirable, then you could consider renaming it using the RenameUser extension."

Another option is to give Admins the 'hideuser' right, and indefinitely block the user with the Hide username from edits and lists option selected.

Extension:UserMerge is also useful.

Where do I get the spam blacklist from and how do I install it?
The spam blacklist extension can be found in Git, just like all other officially supported extensions. For installation and configuration instructions, consult the file and extension page over here.

How do I use $wgSpamRegex to block more than one string?
$wgSpamRegex (see Manual) is a powerful filter for page content. Adding multiple items to the regex, however, can be awkward. Consider this snippet:

This example code allows convenient addition of additional items to the regex without fiddling about each time. It also demonstrates two popular filters, which block some of the most common spam attacks.


 * See also: Extension:SpamRegex

Are there additional ways to fight spam?
See Manual:Combating spam for an overview of anti-spam measures such as Captcha, content filtering and restricting edition.

Anti-vandalism
See Manual:Combating vandalism for hints and suggestions on how to deal with wiki vandalism.

I've found a bug or have a feature request. Where do I post it?
Bugs and feature requests should be posted on Phabricator. See How to report a bug.

I'm getting a strange error. What now?

 * See if it is covered by Manual:Errors and Symptoms
 * Try to find out more about the problem, see How to debug MediaWiki
 * See the section below for information on how to contact developers and other knowledgabe users.

I tried that but it didn't work

 * I had a problem, I came to this page and it told me how to fix it. But it didn't work, the problem is still there!!!!

Nine times out of ten this is because you didn't clear your cache. The simple test for this is to request a page that hasn't been requested before. Select the part of the URL in the address bar that contains the page title (e.g. Main_Page). Twiddle your fingers on the keyboard for a while, hit enter. Check if the problem is on that page too.

MediaWiki uses both a server-side cache and a client-side cache, so clearing your browser cache is often not enough. See the relevant entry below for more details.

Here are some other things to check:
 * Were you editing the right file? Try inserting some garbage into the file you edited, does it break anything?
 * A great debugging tool in this case is to create a file called phpinfo.php, containing only . Upload it into your web directory and invoke it with your browser. Check the document root and the path to php.ini.
 * Were you editing the right part of the file? Did you create a duplicate entry in php.ini? Add new settings to the end of LocalSettings.php, not to the beginning.
 * If you created a .htaccess, are you sure AllowOverrides is on? Ask your hosting provider.

I have a question not answered here. Where do I go next?
If you've exhausted the FAQ above, please try the following:


 * Check the other sources of help on this site
 * Search the rest of this site
 * Search older documentation archived on Meta; Useful developer documentation remains on Meta.wikimedia.org in the category Pages to be exported to MediaWiki.org until the m:Meta:MetaProject to transfer content to MediaWiki.org completes
 * Search the web
 * Dig into the source
 * See the section below for information on how to contact developers and other knowledgeable users.

Still no luck. Where can I ask for help?

 * Post a message at Project:Support desk
 * Email the mediawiki-l mailing list (try and search the archive first).
 * Ask the developers in our IRC channel.

Recommended reading

 * Asking smart questions
 * Effective bug reporting
 * Getting help on IRC
 * Books about MediaWiki