成为 MediaWiki 的贡献者

From MediaWiki.org
Jump to: navigation, search
This page is a translated version of the page How to become a MediaWiki hacker and the translation is 64% complete.

Other languages:
العربية • ‎български • ‎dansk • ‎Deutsch • ‎Ελληνικά • ‎English • ‎español • ‎فارسی • ‎français • ‎हिन्दी • ‎magyar • ‎interlingua • ‎Bahasa Indonesia • ‎italiano • ‎日本語 • ‎한국어 • ‎Nederlands • ‎occitan • ‎ਪੰਜਾਬੀ • ‎polski • ‎português • ‎português do Brasil • ‎română • ‎русский • ‎српски / srpski • ‎svenska • ‎ไทย • ‎Türkçe • ‎Tiếng Việt • ‎中文

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

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

如果你是一个有经验的开发者,请访问开发人员中心Developer hub

对于其他的方式涉足维基媒体社区,参见如何貢獻How to contribute

概覽

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

MediaWiki由PHP语言编写。[1] 它使用jQuery作为JavaScript的客户端库。

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

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

源代码是使用Git修改控制系统管理的。[5]
代码回顾可以在GerritGerrit中进行。 遵守教程来创立Git与Gerrit以提交补丁。

漏洞报告与任务是在Phabricator中管理的。 本页可以帮助您成为MediaWiki的贡献者。 此入門教學,而是引導您至不同任何您覺得必要學習的內容。

配置您的开发环境

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

虛擬機器與Vargant

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

手动安装

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

推荐阅读

当一个开发者修复MediaWiki的漏洞时,你可以观察他,包括他如何开展调查,执行git commit命令,如何使漏洞被再查以及修复,如何关闭Bugzilla表单或者现在取代Bugzilla的PhabricatorPhabricator


回饋、問題與支援

  • 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 IRCIRC, 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 PhabricatorPhabricator). "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上的多数问题通常也可以被其他社区成员解决(即使有人不在)。 如果没人回答,请基于漏洞报告与问题相关的维基页面继续提问,不要放弃。
  • 聯繫交流Communication了解更多。
  • 你也可以在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.


附录

MediaWiki贡献者在印度班加罗尔办公。

PHP

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

學習PHP
  • PHP指导 — 在许多不同语言中都可用。 如果你不会用PHP且也不会用其他对象导向语言,PHP会这些语言中你容易学的。
  • PHP Programming at Wikibooks.
  • PHP topic at Wikiversity.
PHP资源
需要知道的员工
  • MediaWiki中的脚本maintenance/eval.php提供了一个基本的包含MediaWiki对象与分级的PHP编译器。

数据库

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

学习MySQL或MariaDB
MySQL/MariaDB资源
要知道的东西
  • 用MySQL/MariaDB測試你的代碼。
    • MediaWiki currently uses MySQL and MariaDB as the primary database back-end. 它同样支持其他DBMS,例如PostgreSQLSQLite。 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 resources

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
MediaWiki resources

MediaWiki扩展

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

MediaWiki extensions basics
MediaWiki扩展手册:

參見

  1. 但并不是所有Mediawiki内容都是如此。有些支持性工具由其他语言编写,他们包括batch files, shell scripts, makefiles还有Python.
  2. MediaWiki在多数支持PHP的平台上都能运行,但在非LAMP上,MediaWiki的表现与功能可能会因为特定操作系统属性与特定实用工具的缺失大打折扣。
  3. MediaWiki此外支持DBMS,包括OraclePostgreSQL, SQLite,以及微软SQL服务等。
  4. 开发者中既有志愿者,也有如承包商之类各行各业的工薪者。他们的全部姓名被列在了DevelopersDevelopers
  5. 可以在phabricator.wikimedia.org浏览源代码,修改代码库,或者你也可以用Gerrit下载源代码到你的电脑。