How to become a MediaWiki hacker/zh

这篇文章用以帮助开发者学习开发MediaWik 内核和MediaWiki扩展的基础技能. 请注意，多数情况下，你并不想去随便删改MediaWiki的核心文件，除非你真的知道你在干什么！

入门Wikimedia开发的主要方式就是给那些有新手指导的Wikimedia项目做贡献. 另一种毋须指导的替代方案则是去debug.

如果你是一个有经验的开发者，请访问.

对于其他的方式涉足维基媒体社区，参见.

概覽
MediaWiki是维基百科，與其姐妹项目，还有世界各地数以千计的维基网站使用的软件.

MediaWiki由PHP语言编写. 它使用jQuery作为JavaScript的客户端库.

MediaWiki首先是为LAMP平台编写 ，并且在多数操作系统中是可用的. MediaWiki首要使用MySQL与MariaDB数据库服务器.

MediaWiki在开源环境下开发 ,代码的调整大多在网上完成，并受到Wikimedia基金会的支持，不过志愿者为之付出甚多.

源代码是使用Git修改控制系统管理的. 代码回顾可以在中进行. 遵守教程来创立Git与Gerrit以提交补丁. 漏洞报告与任务是在Phabricator中管理的. 本页可以帮助您成为MediaWiki的贡献者. 此非入門教學，而是引導您至不同任何您覺得必要學習的內容.
 * 开发讨论可以在各种邮件列表和IRC 频道中进行. 主要开发者名单在此：wikitech-l.  主要开发者列表为wikitech-l，主要的开发者 IRC 频道为#mediawiki和#wikimedia-dev.

配置您的开发环境
大多数项目使用Git和Gerrit. 按照Gerrit指南来创建您的开发者帐号. 然後你可以去下載我們的代碼，做出改變，測試他們，然後提交補丁. 共有兩種方法架設您的開發環境：使用預設虛擬機器（vagrant），或手動.

虛擬機器與Vargant

 * 安裝Vagrant - 這些步驟會安裝MediaWiki伺服器於所有符合需求的Linux虛擬機器（可用於Linux、Windows，或Mac hosts）

手动安装

 * 安裝需求 — 檢查硬體需求後，請安裝LAMP、MAMP或WAMP伺服器（Linux、Mac或Windows、plus Apache、MySQL/MariaDB與PHP）.
 * — 於Git下載最新版的原始碼.
 * — 繼續安裝與初始化設定.
 * 架設不同的偵錯模式於您的環境，以提早顯示警告與錯誤.

您不必下載維基百科數據庫資料即可開發MediaWiki功能. 實際上，大部分情況下使用一個幾乎為空的數據庫，裡面只有一些特定的測試頁，會更簡單. 然而，如果由於某種原因你仍想複製維基百科，你可以下載資料.

推荐阅读




回饋、問題與支援
不要在我们的社交频道使用私人电子邮件或者发布支持请求. 
 * You are expected to do some basic research yourself first: Look at the code, try to get some understanding what it is supposed to do, read related documentation, try to find the probable place(s) where you need to make changes in order to fix the bug.
 * If you have general questions about infrastructure (Git, Gerrit, Vagrant), the software architecture or workflows which are not tied to the specific task that you want to work on, use generic channels like, mailing lists, or wiki discussion pages but not the specific task. For example, if you have a problem with Gerrit, the Gerrit discussion page could be a good place to ask.
 * If you have a specific question about the bug itself, comment in the corresponding bug report (normally a task in ). "Can you give me more info how to fix this bug?" is not a good question to start with: The more specific your questions are, the more likely somebody can answer them quickly. If you have no idea at all how to fix the bug, maybe that bug is not (yet) for you - please consider finding an easier one first.
 * When asking, explain what you have tried and found out already, so others can help at the right level. Be specific - for example, copy and paste your commands and their output (if not too long) instead of paraphrasing in your own words. 这避免了误解.
 * Be patient when seeking input and comments. 在IRC上,不要想着为了让别人问你问题, 有什么问题直接说: 在IRC上的多数问题通常也可以被其他社区成员解决. 如果没人回答，请基于漏洞报告与问题相关的维基页面继续提问，不要放弃.
 * 在了解更多.
 * 你也可以在Freenode IRC下#wikimedia-tech channel中的每周技术建议IRC会议上提出任何问题.



告訴別人你正在做这件事
You do not need to ask if you can work on a task. You do not need to announce your plans before you start working on a bug, but it would be welcome. You are welcome to set yourself as the assignee in a task: Use the dropdown Add Action… → Assign/Claim in Phabricator. At the latest when you are close to proposing a patch for the task, it is good to announce in a comment that you are working on it. Your announcement helps others to not work on the bug at the same time and to not duplicate work.

Also note that if a task already has a recent link to a patch in Gerrit and has the project "Patch-For-Review" associated in Phabricator, choose a different task to work on instead - avoid duplicating work. If an existing patch in Gerrit has not been merged and has not seen any changes for a long time, you could also pick up that existing patch and improve it, based on the feedback in Gerrit and in the task.

If you stop working on a task, remove yourself as the assignee of the task, so others know that they can work on the task and don't expect you to still work on it.

By communicating early you will get more attention, feedback and help from community members. 

PHP
MediaWiki由PHP编写,所以你需要了解并熟悉PHP才可以熟练使用MediaWiki的核心代码.


 * 學習PHP
 * PHP指导 — 在许多不同语言中都可用. 如果你不会用PHP且也不会用其他对象导向语言，PHP会这些语言中你容易学的.
 * PHP Programming at Wikibooks.
 * PHP topic at Wikiversity.


 * PHP资源:
 * PHP手册 — 在许多不同语言里可用.
 * MediaWiki社区内部的PHP编程条例.


 * 需要知道的员工:
 * MediaWiki中的脚本 提供了一个基本的包含MediaWiki对象与分级的PHP编译器.

数据库
许多特性需要对数据库做出一定程度的修改，所以你常常需要熟悉MySQL/MariaDB.


 * 学习MySQL或MariaDB
 * MySQL指导 — From the MySQL 5.0 reference manual.
 * MySQL at Wikibooks.


 * MySQL/MariaDB资源
 * MySQL Reference Manuals — 在许多不同语言里可用.
 * MariaDB知识库
 * MediaWiki社区内部的数据库编码条例.
 * Accessing the database


 * 要知道的东西:
 * 用MySQL/MariaDB測試你的代碼.
 * MediaWiki currently uses MySQL and MariaDB as the primary database back-end. 它同样支持其他DBMS,例如PostgreSQL和SQLite. However, almost all developers use MySQL/MariaDB and don't test other DBs, which consequently break on a regular basis. You're therefore advised to use MySQL/MariaDB when testing patches, unless you're specifically trying to improve support for another DB. In the latter case, make sure you're careful not to break MySQL/MariaDB (or write queries that are horribly inefficient in it), since MySQL/MariaDB is what everybody else uses.

JavaScript和CSS
JavaScript and CSS have become omnipresent in front-end code. You don't have to be familiar with JavaScript, jQuery and CSS to work on MediaWiki, but you might need to, depending on what you choose to work on.


 * 学习JavaScript和CSS
 * JavaScript and CSS at Wikibooks.
 * 入门jQuery — jQuery指导
 * Learning JavaScript — references and sources


 * JavaScript and CSS resources
 * JavaScript coding conventions within the MediaWiki community.
 * CSS coding conventions within the MediaWiki community.

MediaWiki
The MediaWiki code base is large and some parts are ugly; don't be overwhelmed by it. When you're first starting off, aim to write features or fix bugs which only touch a small region of code.


 * MediaWiki basics and must-reads:
 *  — A high-level overview of the main components of MediaWiki and how they work with each other.
 *  — An overview of why and how to write secure code.


 * MediaWiki resources:
 * — A list of important files and links to more detailed information.
 * — A list of hooks. If you're trying to find what part of the codebase does something, often a good place to start is by searching for the related hooks.
 * — An overview of general coding conventions within the MediaWiki community.


 * 代码文档 — Automatically generated documentation from the code and code comments.
 * — A guide to debugging MediaWiki.
 * — A tool to interact with MediaWiki objects live.

MediaWiki扩展
If you choose to work on MediaWiki extensions code, the following links provide more information.


 * MediaWiki extensions basics:
 * Developing extensions — How to write an extension for MediaWiki.
 * 扩展写作教程


 * MediaWiki扩展手册：
 * 最佳实践活动
 * A brief introduction to MediaWiki extension development — A video presentation about how to create a MediaWiki extension (slides).
 * Making a MediaWiki extension — Covers how to develop an extension for Mediawiki, best practices, and how to engage the Mediawiki community. 从2011年2月开始.
 * 开发者小屋中的开发者帮助

參見

 * – 如果你已经把这篇文章读完了，是时候去看看开发者小屋了.
 * MediaWiki Developers Guide – a collection of related pages