Phabricator/Code/zh

本文档描述了维基媒体的Phabricator实例的开发过程. Phabricator是用PHP,编写的，就像MediaWiki一样，它应该有助于入手开发. 在本文档中，我们将首先了解维基媒体如何使用Phabricator，以及在开发过程中会发生什么. 之后，有一些关于如何开始实际开发的注意事项.



维基媒体上的Phabricator
维基媒体使用上游的变化很小的Phabricator实例. 这样做的是因为上游开发人员的高速开发使得维护本地补丁非常麻烦. 对此的例外是扩展，它们位于单独的存储库中，因此不需要定期合并. 因此，任何其他变化都必须通过上游. 这听起来像是一个主要障碍，但在实践中，上游维护人员非常迅速地回应建议.



维基媒体Phabricator bug工作流程
在完成其中一项任务之前，了解错误的生命周期很有帮助. 这里有两个项目： #phabricator用于WMF特定的错误和 #phabricator-upstream用于一般的Phabricator错误. 软件错误和增强请求通常属于第二类.

Phabricator上游工作板显示任务在上游创建之前经历的过程：


 * 积压：这是新任务默认登陆的地方. 停滞的任务也可以在这里找到.
 * 准备就绪：此列中的任务正在等待某人将其复制到错误跟踪器.
 * Upstreamed: Tasks which have been reported upstream. For some tasks this might refer to the old upstream (secure.phabricator.com until 2021), for some tasks this might refer to the current upstream (we.phorge.it).
 * Solved upstream
 * Feedback from Upstream

一旦任务被分发到上流，上游开发人员就会对他们的评估做出回应，并就如何实施该功能提出建议. ''此时，开发人员可以开始部署. ''

在某些情况下，上游开发人员将决定某项功能不适合他们的计划. 在这种情况下，Wikimedia Phabricator中的任务从＃phabricator-upstream项目转移到#phabricator项目，最终回到讨论阶段：这个功能是否足以维护本地补丁？ 一旦确定，补丁将转移到“准备就绪”，并且可以开始部署.

为了防止失望，请不要从开始部署，直到上游或WMF维护者接受您的补丁.



本地更改
As mentioned in the previous section, we try to keep local patches to a minimum. There are limited resources available to maintain patches, and to merge them with changes from upstream. Any local patches therefore have to be discussed within the #phabricator project. It's significantly less work to maintain a phabricator extension, as long as care is taken in avoiding the use of particularly new / unstable APIs from phabricator's core. Although extensions don't require merging and potential code conflicts, they do require testing each time we pull in upstream changes. Phorge does not have any frozen APIs which are deemed safe to depend on.

The current code of the Wikimedia Phabricator instance itself:


 * https://gitlab.wikimedia.org/repos/phabricator/phabricator
 * https://gitlab.wikimedia.org/repos/phabricator/arcanist

当前本地维护的扩展有：


 * Several customizations in one code repository, such as the MediaWiki OAuth extension (not upstreamed; see the Differential revisions and commits at https://secure.phabricator.com/T5096), Security related code, the MediaWiki Userpage field on Phabricator user pages, etc.
 * Antivandalism, still in Gerrit and to be moved to GitLab.



站点配置
Most of the configuration is set through the web interface. Defaults (shared between https://phabricator.wikimedia.org and e.g. https://phab.wmflabs.org) are set using either the puppet maniphest or the Scap template (see T239355).



See Phabricator/Local Dev Environment.

Another way to get set up is by using MediaWiki-Vagrant using the 'phabricator' role. Follow the steps on MediaWiki-Vagrant to install MediaWiki-Vagrant, then enable the phabricator role using

http://phabricator.local.wmftest.net:8080/
 * Access the Phabricator instance at URL:
 * The Phabricator install is located in `/srv/phabricator/` (?) on the VM.



使用Labs VM
If you know how to spin up a VM on Cloud VPS, and have the rights to do so, you can create an instance with the `phabricator::labs` role. This should give you a basic setup with the same configuration as https://phab.wmflabs.org.

Migration code from Bugzilla, RT, Mingle, Trello to Phabricator
The scripts that Wikimedia used for migrating its Bugzilla and RT data to Phabricator are available. Note that the migration code is not bug-free and that it was only written and used for the specific configurations of Wikimedia's tools. Also note other migration scripts, e.g. the GStreamer project used a phill script by Emanuele Aina to import their data from Bugzilla into Phabricator in 2015.

Data was migrated from Mingle to Phabricator via a script available in P129.

The scripts to migrate data from Trello to Phabricator are available. 有关更多信息，请参阅T821.