Bagaimana cara menjadi peretas MediaWiki

From mediawiki.org
This page is a translated version of the page How to become a MediaWiki hacker and the translation is 74% complete.
Outdated translations are marked like this.

Artikel ini ditulis untuk membantu para pengembang belajar keterampilan dasar untuk berkontribusi dalam pengembangan inti MediaWiki dan ekstensi MediaWiki.

Jalur utama untuk mulai mengikuti pengembangan Wikimedia adalah berkontibusi ke proyek Wikimedia yang menawarkan pendampingan. Cara alternatif tanpa pendampingan adalah dengan memperbaiki sebuah kutu pertama yang baik.

Jika Anda merupakan seorang pengembang berpengalaman yang sudah mengenal MediaWiki, kunjungi Pusat pengembang .

Untuk langkah lain untuk bergabung dengan komunitas Wikimedia, lihat Cara berkontribusi .

Gambaran umum

MediaWiki adalah perangkat lunak yang menenagai Wikipedia, proyek saudaranya dan ribuan wiki di dunia.

Kebanyakan isi dan ekstensi MediaWiki ditulis dengan bahasa pemograman PHP. JavaScript digunakan untuk menyediakan elemen-elemen antarmuka inteaktif dengan jQuery dan Vue.js sebagai pustaka JavaScript klien. JavaScript is used for providing interactive interface elements along with jQuery and Vue.js as client JavaScript libraries.

Beberapa alat dukungan ditulis dalam bahasa lain, termasuk berkas tumpak, skrip shell, makefile dan Python.

MediaWiki ditulis utamanya untuk platform LAMP[1] dan dijalankan di kebanyakan sistem operasi. MediaWiki pada umumnya menggunakan peladen basis data MySQL atau MariaDB.[2]

Pengembangan dilakukan dalam gaya sumber terbuka[3], dikoordinasikan secara daring, dan didukung oleh Yayasan Wikimedia, tetapi komunitas sukarelawan memainkan peran penting juga.

  • Diskusi pengembangan dilakukan di Phabricator , Milis , dan saluran IRC. Daftar pengembang utama adalah wikitech-l. Saluran IRC pengembang utama adalah #mediawiki connect dan #wikimedia-dev connect.
  • Kode sumber disimpan di Gerrit dan dikelola menggunakan sistem kendali revisi Git dan bisa dilihat di sini.[4]
  • Peninjauan kode dilakukan di Gerrit dan bisa dilihat di sini. Ikuti tutorial ini untuk mengatur Git dan Gerrit agar bisa mengajukan tambalan.
  • Laporan kutu dan permohonan fitur diisi dan proyek dikoordinasikan di Phabricator dan bisa dilihat di sini.

Find or create a task

Before you ever develop a feature or fix a bug in a MediaWiki project, it is important that you do your research about it. This includes:

  1. Search Phabricator if an open or closed Task (Document Types field) already exists. If it doesn't, create one. If this is a very small change, don't create one.
  2. Find and investigate the code that needs to be changed to implement the feature. Comment your findings on the Phabricator Task if they might be helpful to others who implement it or review your changes.
  3. Determine if you can likely add the feature or fix the bug based the code you investigated and the changes needed. If the task is large or complex, you should find something easier and work your way up to eventually be able to handle tasks of that size. If you believe you can complete it, assign yourself to the Task and begin working on it.

Mengatur lingkungan pengembangan Anda

Once you have found something you can work on, the next step to developing MediaWiki or an extension is creating an environment to run MediaWiki, its database, and any other external features so that you can develop and test them.

You can install and develop MediaWiki on Linux, Windows, or macOS using any of the three solutions below.

Docker

Docker adalah pilihan yang bagus jika Anda ingin menyetel instalasai MediaWiki dengan cepat dan tidak berencana menginstal banyak ekstensi.

Anda juga bisa mencoba mwcli yang menyetel Docker dengan sedikit perintah sederhana dan menyediakan fungsionalitas dasar untuk memadukan MediaWiki, MySQL, ElasticSearch, Memcached, dan tipe-tipe kontainer lain.

Vagrant

  • Pemasangan Vagrant — Langkah-langkah ini akan memasang peladen MediaWiki dengan semua kebutuhannya di dalam sebuah mesin virtual Linux (bisa digunakan di hos Linux, Windows, atau Mac).

Vagrant allows you start a MediaWiki instance you can develop as well as allowing you to add and develop any of 250+ extensions - all with a single command.

This saves you installation and configuration time compared to manually adding extensions in a Docker or local installation, but it runs a bit slower than the other two options.

Instalasi lokal

Local installation is a good option if you want to set up a simple development environment quickly without using Docker.

Open a code editor

The two recommended code editors for editing MediaWiki are VSCode and PhpStorm. VSCode is free and PhpStorm is paid, however, you can acquire a PhpStorm license for free if you are a student by linking your GitHub Education account to your JetBrains account, or by requesting a license granted to Wikimedia.

To determine which editor you should install and use, know that all-around, PhpStorm has more and more-powerful features than VSCode. However, PhpStorm takes significantly longer to load on start than VSCode as it builds an index of the entire repository whereas VSCode progressively loads. Therefore, VSCode is typically useful for file-viewing sessions or small changes and PhpStorm for larger changes. It makes sense to have both installed for these reasons.

To develop the MediaWiki codebase that is inside a Docker container you can establish a remote connection to it and open the MediaWiki folder inside it using VSCode or PhpStorm.

Change and test the code

Change the code and view your changes by reloading your MediaWiki browser tab. Make sure to follow Manual:Konvensi pengkodean . Write and run tests on your code to make sure it works and is formatted properly.

Note, you can save time by ensuring your changes will be accepted before taking the time to write tests. Create a patch without needed tests and ask for someone to review it stating that you will add tests after they review it.

Create a patch

Finally, to submit your code to be reviewed and added to the repository you are contributing to, follow Gerrit/Tutorial .

Tip dan panduan komunikasi

Saksikan seorang pengembang memperbaiki sebuah kutu di dalam ekstensi MediaWiki, mencakup investigasi, commit git, mendorongnya agar ditinjau dan digabungkan, dan menutup tiket Bugzilla (sekarang digantikan oleh Phabricator ).

Follow these tips to communicate effectively and get help from community members.

Use Phabricator tasks effectively

When you plan to work on a Phabricator task:

  • No need to ask for permission: You can work on unassigned tasks without asking someone to assign them to you. There is no authority who assigns tasks or who needs to be asked first.
    • If a task already has a recent patch in Gerrit, choose a different task to work on instead.
    • If an existing patch in Gerrit has not been merged and has not seen any changes for a long time, you could improve that existing patch, based on the feedback in Gerrit and in the task.
  • Do your research: When you consider working on a task, do research before you start coding. Look at the code, try to understand what it is supposed to do, read related documentation, and try to find the places where you need to make code changes.
    • In a Phabricator task, use the project tags in the side bar to find the code repository for the task.
    • If you have no idea at all how to fix the bug, consider finding an easier one first.
  • You do not need to announce your plans before you start working on a task, but you should communicate that you are working on the task.
    • When you start work, set yourself as task assignee by clicking Edit Task… in Phabricator, and set your Phabricator username in the Assigned To field. This communicates to others that you are working on it, so they don't duplicate work.
    • When your plans or interests change: If you are no longer working on a task, remove yourself as the assignee of the task. This tells others that they can work on the task, and they won't expect you to still work on it.
  • Follow Phabricator etiquette.
    • In Phabricator tasks, discuss only specific questions about the topic of that task. Don't use Phabricator to ask general questions, like how to set up a development environment or how to fix problems with Gerrit.

Compose good questions

  • Be specific and provide context: Instead of simply asking "Can you give me more info?", "Please guide me", or "Please tell me how to start", include the following information in your question:
    • What are you trying to achieve?
    • What have you already tried? Copy and paste your commands and their output (if not too long) instead of paraphrasing in your own words.
    • What have you found out already during your research? Include links to code, documentation, or other resources you already consulted.
  • Use specific titles and subject lines in your communication. "Proposal draft" or "Need help" is not specific.
  • Keep conversations readable: When you reply in Zulip, in Phabricator tasks, or on mailing lists, only quote sections of previous comments that are relevant to your response. If you quote a complete previous comment, it makes threads hard to read.

Follow communication policies and best practices

Before you send or post your question:

Ask in the right place

  • Tanya di depan umum: Jangan mengirim pesan pribadi jika topik percakapan Anda tidak rahasia. Private messages don't help others.
  • Ask and discuss in the best place:
    • In Phabricator tasks, discuss only specific questions about the topic of that task.
    • Ask general technical questions, like how to set up a development environment or how to fix problems with Gerrit, in the places listed on Komunikasi .
    • If you take part in an outreach program, then Zulip is for discussing questions about the outreach programs themselves.

Be patient

After you post your question:

  • Do not ask people for code review in a separate message. People receive Gerrit and Phabricator notifications and will respond when they can.
  • When seeking input and comments, especially during weekends and holidays, you may need to wait until business hours resume. On chat channels like IRC: if nobody answers, try again at a different time; don't just give up!
  • If you don't get an answer even after waiting and being patient, consider if other Communication channels might be a better place to ask your question.

Apendiks

Kontributor MediaWiki bekerja di Bengaluru, India.

PHP

MediaWiki ditulis dalam bahasa PHP, jadi Anda perlu mengenali PHP sebelum meretas inti MediaWiki.

Belajar PHP
  • Tutorial PHP — Tersedia dalam berbagai bahasa. Jika Anda tidak tahu apa-apa tentang PHP tetapi tahu cara memprogram dalam bahasa pemrograman berorientasi objek lainnya, PHP akan mudah untuk dipelajari.
  • PHP Programming di Wikibooks.
  • PHP di Wikiversity.
Sumber daya PHP
Hal-hal yang perlu diketahui
  • Skrip maintenance/eval.php di MediaWiki menyediakan sebuah interpreter PHP dasar dengan objek dan kelas MediaWiki sudah dimuat.
  • Juga, skrip maintenance/shell.php di MediaWiki adalah pengganti maintenance/eval.php berdasarkan PsySH, lihat Manual:Shell.php

Basis data

Kebanyakan fitur memerlukan manipulasi basis data, jadi Anda sering kali perlu mengenali MySQL/MariaDB.

Belajar MySQL/MariaDB
Sumber daya MySQL/MariaDB
Hal-hal yang perlu diketahui
  • Uji coba kode Anda dengan MySQL/MariaDB.
    • MediaWiki sekarang sedang menggunakan MySQL dan MariaDB sebagai basis data bagian belakang utama. MediaWiki juga mendukugn DBMS lainnya, seperti PostgreSQL dan SQLite. Akan tetapi, hampir semua pengembang menggunakan MySQL/MariaDB dan tidak menguji DB lainnya sehingga basis data lain kerap mengalami galat. Anda disarankan menggunakan MySQL/MariaDB ketika menguji tambalan, kecuali Anda memang mencoba memperbaiki dukungan untuk DB lainnya. Kalau begitu, berhati-hatilah agar Anda tidak membuat MySQL/MariaDB galat (atau menulis kueri yang tidak efisien dalam mereka), karena MySQL/MariaDB adalah yang digunakan semua orang.

JavaScript dan CSS

JavaScript dan CSS ada di mana-mana di kode bagian depan. Anda tidak harus mengenal JavaScript, jQuery dan CSS untuk mengerjakan MediaWiki, tetapi Anda mungkin perlu, bergantung pada apa yang Anda kerjakan.

Belajar JavaScript dan CSS
Sumber daya JavaScript dan CSS

MediaWiki

Basis kode MediaWiki besar dan beberapa bagiannya tidak cantik; jangan terbebani oleh itu. Ketika Anda memulai, bertujuanlah menulis fitur atau memperbaiki kutu yang hanya menyentuk wilayah kode yang kecil.

Dasar dan bacaan wajib MediaWiki
Sumber daya MediaWiki

Ekstensi MediaWiki

Jika Anda memutuskan untuk mengerjakan kode ekstensi MediaWiki, pranala berikut menyediakan informasi lebih lanjut.

Dasar ekstensi MediaWiki
Sumber daya ekstensi MediaWiki

Kulit MediaWiki

Manual:How to make a MediaWiki skin bisa membantu jika Anda ingin mengerjakan kulit MediaWiki.

Lihat pula

Catatan kaki

  1. MediaWiki berjalan di kebanyakan platform yang mendukung PHP, tetapi, ketidakberadaan utilitas atau fitur sistem operasi tertentu bisa membatasi fungsionalitas atau performa MediaWiki di platform non-LAMP.
  2. MediaWiki punya dukungan untuk DBMS selain MySQL dan MariaDB, termasuk PostgreSQL, SQLite.
  3. Para pengembang merupakan gabungan sukarelawan dan staf (atau kontraktor) yang dibayar dari berbagai organisasi. Untuk daftar lengkap orang yang mengerjakan kode MediaWiki, bacalah artikel $def.
  4. Telusuri kode sumber dan revisi repositori kode di https://phabricator.wikimedia.org/diffusion/ atau unduh kode sumbernya ke sistem Anda menggunakan Gerrit.