User:Zhangjintao/zh



本FAQ是英文版的译本,可能不是最新的.

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

我能将MediaWiki用于某个用途么?
MediaWiki是自由软件,这意味着你可以以任意方式使用它而不需要法律上的许可.你的wiki上的内容可以采用不同的协议.当然,作为支持维基百科运行的软件而发展起来的项目,我们鼓励你使用一个自由许可证授权你的wiki上的内容,但是这不是必须的.

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

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

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

能通过软件包管理器安装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进行备份，或难以将它升级到更新的版本. 如果完全脱离终端访问，您将不能完成一些维护任务.

如何安装扩展?
参见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中:

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


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

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

可能的解决方案：*设定$wgMimeDetectorCommand的值，例如：在Unix或Linux，您可以将它设为  :  
 * 编译／安装PHP插件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.

如何重置密码?

 * 参阅 Manual:Resetting passwords

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

 * 参阅 Manual:Interwiki

如何让显示的URL更短?
(例如用 /wiki/Article_Name as opposed 取代 /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.

要改变默认搜索的名字空间,在LocalSettings.php里设置$wgNamespacesToBeSearchedDefault.例如要默认搜索主名字空间和分类名字空间: 某些情况下,你在改变默认设置后希望改变现有用户的设置.

要这样做的话,在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移动到另一台电脑上吗?
应该可以,实质上就是备份你的安装然后"还原"到一台新电脑上.然后对配置进行一些适当的调整以适合新服务器的需要.

那么,如何做?
参阅 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中的值.

如何隐藏左侧的导航栏
换句话说,你希望内容占据全部的宽度来隐藏logo和左侧导航? 要隐藏它们,将下面的代码添加到MediaWiki:Common.css中.

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

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

我能自定义左侧顶部的标志吗,如果可以的话,怎样做?

 * 要修改标志的图片，参阅上节.
 * 要修改样式,在样式表中为#p-logo选择器定义样式即可,默认的样式像这样:

记住,要编辑你wiki上的MediaWiki:Common.css一类的页面而不是直接修改核心css文件.

如何改变点击左上角的标志后跳转到的页面?
默认情况下点击logo会返回到首页,要指定哪一个页面是首页,编辑MediaWiki:Mainpage.

要在点击logo时前往任意的其他页面(不一定是你的wiki),你可以向LocalSettings.php中增加一个hook来覆盖默认设置.

改变标志的大小
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中:


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

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

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

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

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

你也可以在MediaWiki:Anonnotice上放置一些文本,当用户未登录时会出现在页面的上方.

如何指定首页?
默认的首页名称为"首页".编辑MediaWiki:Mainpage来改变.有时边栏中的"首页"链接可能没有改变,这时需要编辑 MediaWiki:Sidebar.

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

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

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

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

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

如果你的皮肤不是使用 标签和 类选择器的话,你需要自行调整. If the skin uses a different element for the title than a  element with class , you'll need to find the appropriate CSS selector to apply for that skin.

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

某个页面

 * 把魔术字  放在页面上.


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


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


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

如何改变界面文字?

 * 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中:

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


 * 也请参阅：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.

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

编辑,加入下面一行:


 * 另参阅

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

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

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

 * 注意: MediaWiki 不是为这种用法设计的!

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 (参阅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.在最近的MediaWiki版本中,默认的设置为MediaWiki:Pagetitle is $1 -.

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

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)?
Vector 推出于 1.16版本,在1.17版本中为默认皮肤. 参阅Manual:$wgDefaultSkin 来设置你wiki的默认皮肤.

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

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

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

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

记得清除缓存来查看结果.

如何编辑页面?

 * 参阅：MyLanguage/Help:Editing pages

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

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


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

能删除一个旧版本的页面吗?
Old versions of page data are retained in the database and can be accessed via the page history features. This is useful for reviewing changes and correcting or reverting undesirable ones, but in some cases, administrators might want to make this information unavailable, for legal reasons, or to reduce the size of the database.


 * Administrators can delete an old revision of a page by deleting the page, and then selectively undeleting revisions to be kept
 * The Oversight extension (also known as HideRevision) can be used to move harmful revisions out of page histories on older versions of MediaWiki (<1.16).
 * For newer MediaWikis (1.14+), you can enable the core RevisionDelete feature that allows privileged users to remove single revisions from page histories.
 * The  maintenance script can mass-delete all old revisions of pages and their associated text records.


 * 也请参阅：Manual:Removing embarrassment

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

 * 请参阅： RevisionDelete

You can also delete a page, and then restore only the revisions you want.

有没有一个编辑教程?
There are several editing tutorials available, mostly on Wikimedia sister projects, such as Wikipedia. There are also markup references, etc. available on Meta.


 * The page Help:Editing pages on this site
 * Editing help content on Meta
 * The How to edit a page guide on the English Wikipedia

如何查看某个页面的打印版本?
MediaWiki includes stylesheets which automatically style a page appropriately when it is printed; using the print or print preview function within your browser ought to render the page in a printable form.

You can also view this printable form using the printable version link in the sidebar under Toolbox or Print/export if using the Collection extension.

如何使用模板?

 * 参阅Help:Templates

我能使用维基共享资源上的多媒体文件吗?
Yes, this is encouraged through the use of Manual:$wgUseInstantCommons.


 * 也请参阅：InstantCommons

如使用一个模板作为签名?
When you look at your preferences, you 参阅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) Create the first page (FIRST PAGE)
 * 2) Go to your preferences, check "raw signature" and put  in the signature.  Save
 * 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.

如何加入沙盒功能?
In wiki terms, a sandbox is simply a "play pen"; a page which users can mess about in. This is an ordinary page created in the normal manner, and can be located wherever you like. There is no special sandbox functionality built into MediaWiki.

Users often inquire about the Wikipedia sandboxes, which seem to be self-emptying. 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.

如何在个人工具栏(右上角)加入一个沙盒链接?
You need to add the Gadget extension and add the Sandbox gadget. You will probably also want to make it a default gadget.

如何运行一个多语言wiki?
To make your wiki multilingual and a tool for translation, allowing translation of pages and of the custom interface (like the sidebar), use the Translate extension; there's extensive documentation.

从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 -- 参阅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.

从其他类型文件中导入
There are a variety of tools available to help convert content from HTML (and other formats) to MediaWiki markup.


 * 开发者和系统管理员工具
 * HTML::WikiConverter::MediaWiki - a Perl module for converting from HTML to MediaWiki markup.
 * Wikificator - a Javascript MediaWiki extension that converts XHTML to MediaWiki markup.
 * The Edit.php, importImages.php and ImportTextFile.php maintenance scripts can be used to import text and images into MediaWiki.


 * 用户工具
 * 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.

从其他网站(例如维基百科)导入的模板不工作
You probably need to install some extensions used on the source wiki, such as ParserFunctions or sometimes Cite. Also, make sure that you copied all site CSS and JavaScript required by the template.

如何让多个wiki使用一个凭据登录?

 * If you're starting from scratch or you're switching from one wiki to multiple, you can use $wgSharedDB and $wgSharedTables to have all wikis share the user table of the "main" wiki. You can share other tables as well, as long as they don't contain any data dependent on non-shared tables or data specific to one wiki. 参阅Manual:Shared database for examples and more information.
 * 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?
The basic steps to improving MediaWiki (that is, becoming a MediaWiki developer) are:


 * Install Git
 * Download the Git "clone" of the MediaWiki source code
 * Get a server, a database, and PHP running on your computer (this can be annoying, so please ask for help if something isn't working)
 * Get MediaWiki running on your computer off that Git checkout (can be annoying as well, so, ditto)
 * Fix the problem or add the feature you were thinking of, or if you don't have one in mind, look at one of the "annoying little bug"s
 * Edit the source code of the relevant file(s) to fix the problem
 * Follow Gerrit/Tutorial

如何运行一个机器人?

 * 参阅Manual:Bots

You might want to use the Pywikibot framework.

如何设置 noindex nofollow
Set  in LocalSettings.php

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

 * 请参阅： Manual:Wiki family

如何添加meta标签?
The OutputPage class includes an addMeta methods which can be used to add meta tags. 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.' );

…帮助名字空间是空的?
The Help namespace currently ships in a blank state. It's up to you how much or how little help you give to your site visitors and whether this relates to other aspects of your site. Obviously you can easily link your visitors to help resources elsewhere.

We don't currently have a clean, internationalised set of help pages under a free license. However, if you want to copy in some help information onto your site, about how to use a wiki (a MediaWiki powered wiki) you are free to copy the Help:Contents from this wiki. This set of pages have been deliberately created for this purpose, with wiki-neutral information, and no license restrictions. 参阅Project:PD help. More help is available at the Meta-Wiki MediaWiki Handbook.

…升级后某些图像无法显示?
Several users have reported that, following an upgrade or a moving of their wiki, several images fail to be shown inline. The files exist, and the image description pages show a MIME type of  and, in some cases, a warning about potentially dangerous files.

To fix this, run the  script from the command line. This will set MIME information for each file in the database.

…png格式的图片没有缩略图?
After upgrading to a more recent version of PHP, it is possible a different MimeMagic.php function is being used to detect file MIME types, particularly the built-in PHP function mime_content_type, which fails to detect PNG files. Search the web for mime_content_type png for information on fixing this bug at the PHP level, possibly by editing your magic.mime file.

参阅here for more info.

…搜索一个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 is in a development state at present, and has not been packaged into a general release. The code can be downloaded from Git if desired. Or, if you want the latest development version packaged as an archive, get it at.

…某个在维基百科中的功能没法在我的wiki上工作?
Wikipedia and other Wikimedia web sites use the current version of the code in development; at present, this is MediaWiki, pulled from the current development branch. Coupled with the use of several extensions, this means that functionality between these wikis and your particular setup may differ.


 * To obtain the current development code, read 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

…在Fedora上设置好权限后却得到了一个403错误?
Fedora Core enables SELinux by default. Instructions for setting SELinux permissions for MediaWiki are available.

…自动注销了?
This is probably related to cookies or session data, for example a problem with PHP's session.save_path setting. 参阅Log in problems for information.

…我的wiki在Sourceforge上不工作?

 * 参阅Manual:Installing MediaWiki on SourceForge.net.

…留着账户是个好主意?
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.

到那里获得垃圾黑名单?
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.

如何用$wgSpamRegex阻止多个字符串?
尽管$wgSpamRegex在过滤页面内容方面非常强大，在正则表达式里添加多个项目可能把事情弄得很糟糕. 请考虑使用下面的方法： 这段代码范例很方便的在正则表达式里添加额外的字符串而无须每次都费时费力再做调整. 这段代码也展示其他两个很流行的屏蔽一些最常见的垃圾信息攻击的过滤器.
 * 也请参阅: Extension:SpamRegex

有没有其他的方法对抗垃圾骚扰?
参阅Manual:Combating spam 来了解像Captcha一类的反垃圾骚扰的方法.

反破坏相关
参阅Manual:Combating vandalism 获得对抗破坏的一些提示

到哪里提交bug报告和功能请求?
去 Phabricator提交Bug报告和功能请求. 参阅How to report a bug.

发生了一个奇怪的错误,我该怎么办?

 * 看看Manual:Errors_and_Symptoms 里有没有提及. 
 * 尝试寻找更多关于问题的信息，查看How to debug MediaWiki.
 * 查看下面的章节以获取关于如何联络开发者及其它知识丰富的用户的信息.

我尝试过了,但是没用.

 * 我遇到了一个问题,我发现FAQ有解决方案,也照着FAQ做了,但是没用!!!

十有八九是你没清除缓存,有一个非常简单的方法可以访问一个未缓存的页面.在你的地址栏上 的后面随便输入个标题,按下Enter键,看看会不会遇到相同的问题.

MediaWiki使用服务器端和客户端缓存,所以简单清除客户端缓存并不够.刚刚提到的清除缓存一节有指导.

或许你该检查别的:
 * 你编辑的是正确的文件吗?试着在你编辑的文件里乱写一通,有什么坏掉了吗?
 * phpinfo.php(一个只包含  的文件)是调试的好工具,把它上传到你的服务器上,打开它,查找php.ini中指定的文件位置.
 * 你有把设置放在正确的部分吗?你有在php.ini中创建重复的目录吗?记得把新的设置加到LocalSettings.php的最下面(而不是最上面!)
 * 如果你有创建 .htaccess, 请确定AllowOverrides打开了吗? 可以问问你的主机商.

有个没提到的问题,怎么办?
如果你已经仔细研究了上面的常见问题并且还是找不到答案的话，请尝试以下方法：
 * 在此网站上查看other sources of help.
 * 搜索此网站的其他内容.
 * 检索Meta里所存档的旧文档；有用的开发者文档被保留在Meta.wikimedia.org上的Pages to be exported to MediaWiki.org分类里，直到从MetaProject向MediaWiki转移完成.
 * 搜索互联网.
 * 深挖源码.
 * 查看下面的小节，了解如何联络开发人员以及其他知识丰富的用户.

运气不好,没有得到帮助咋办?

 * 在Project:Support_desk上提问.
 * 写邮件给mediawiki-l邮件列表 (也可以先搜索一下文件存档).
 * 在我们的IRC频道(Freenode网络，#mediawiki频道)里直接向开发者提问.

推荐阅读

 * 提问的智慧 注:请使用代理访问.本文含有中文版
 * 如何有效的报告BUG 注:本文含有中文版
 * 如何使用IRC频道获得有价值的帮助


 * Books about MediaWiki