Загрузка з Git

From mediawiki.org
This page is a translated version of the page Download from Git and the translation is 41% complete.
Outdated translations are marked like this.

Git — гэта разьмеркаванае праграмнае забесьпячэньне для кантролю вэрсіяў. Яно дазваляе карыстальнікам спампоўваць самую актуальную вэрсію крынічнага коду з усімі галінамі і пазначанымі вэрсіямі па вашым жаданьні.

Калі вы распрацоўнік і хочаце выкладаць латкі, пампуйце з Git.

Калі вы ня хочаце займацца распрацоўкай, а толькі ўсталяваць MediaWiki і пашырэньні, тады пампуйце стабільныя зборкі.

Глядзіце старонку Git дзеля падрабязнай інфармацыі, асабліва, што тычыцца ўнёску ў праект. Ніжэй знаходзяцца рэкамэндацыі па некаторых найбольш распаўсюджаных задачах.

Неабходныя кампанэнты

Вы мусіце ўсталяваць Git перад тым, як ўжываць яго. Існуе шмат шляхоў, як атрымаць Git у залежнасьці ад вашай апэрацыйнай сыстэмы. Глядзіце інструкцыю па наладцы Git або карыстайцеся сваім улюбёным пашуковікам.

It is recommended that you have Composer installed to download and install third party libraries, but not required.

Выкарыстаньне Git для спампоўкі MediaWiki

Спампоўка

У цяперашні час вы можаце спампаваць ядро MediaWiki з дапамогай Git, а таксама ўсе пашырэньні, якія цяпер усталяваныя на клястэры сэрвэраў фундацыі «Вікімэдыі», ды яшчэ мноства іншых пашырэньняў, разьмешчаных на gerrit .

Першы крок — зрабіць клон сховішча MediaWiki. Гэта можа заняць час.

Download for development

Актуальная вэрсія MediaWiki для распрацоўнікаў знаходзіцца ў «майстар»-галіне.

Сьпярша пераканайцеся, што вы стварылі ўліковы запіс распрацоўніка, каб атрымаць імя карыстальніка ssh.

Then, in a terminal window, enter the following command to clone the repository:

git clone https://gerrit.wikimedia.org/r/mediawiki/core.git mediawiki

This clones the entire MediaWiki core repository, synced to the master branch, into a sub-directory named mediawiki.

To install into a different directory, change that in the command line (for more info refer to these docs). Once the repository is cloned, you can switch to different branches or tags. The development branch, master, is the cutting-edge, developer version of MediaWiki; you should not use master code for production under any circumstances as it is not considered stable.

Download a stable branch

Гэта робіць клон усяго сховішча ядра MediaWiki. Дапомнай «галіной» будзе самая апошняя вэрсія MediaWiki для распрацоўнікаў. Калі клон сховішча будзе створаны, вы зможаце лёгка пераключацца паміж рознымі галінамі або цэтлікамі (глядзіце ніжэй), у тым ліку і на стабільныя вэрсіі MediaWiki.

git clone https://gerrit.wikimedia.org/r/mediawiki/core.git --branch REL1_41 mediawiki

If you have a slow internet connection and want to reduce the number of revisions that are cloned, add --depth=1 to the git clone command.

Цэтлікі MediaWiki (стабільная вэрсія)

Акрамя таго, вызначаныя стабільныя вэрсіі MediaWiki пазначаюцца з дапамогай «цэтлікаў». Яны аналягічныя tar-архівам з крынічным кодам. Currently, these are 1.41.0 (stable), 1.39.6 (LTS) and 1.39.6 (legacy LTS).

You can see all available tags with:

git tag -l | sort -V

Каб выкарыстаць пэўны цэтлік, напрыклад апошняга стабільнага выпуску:

git checkout 1.41.0

Update the Git submodules

The branches and tags have a bunch of Git submodules in them, for commonly-used extensions and skins and for the vendor/ directory. The master branch does not have these. To update the submodules, run:

cd mediawiki
git submodule update --init --recursive

Fetch external libraries

MediaWiki uses Composer to manage external PHP libraries, all of which end up in the vendor/ directory in your MediaWiki directory.

To install these needed libraries, you have a choice:

  • Download and install the composer PHAR, optionally rename the composer.phar file as instructed for your OS, and then run composer update --no-dev from your MediaWiki directory. This is the recommended approach.
    • If the default PHP CLI version does not match the web server's PHP version, specify it with e.g. php7.4 composer.phar update --no-dev.
  • Or, if you don't want to use Composer or if you want to use the exact same set of vendor libraries as used on the WMF production cluster, you can instead create a vendor/ directory inside the core folder of your MediaWiki installation:


git clone https://gerrit.wikimedia.org/r/mediawiki/vendor.git

    • Note that if any of your extensions have their own Composer requirements, then you cannot use this option.

Prior to MediaWiki 1.25, external libraries were kept in the core repository, and no package manager was required.

Падтрымка ў актуальным стане

Калі вы выкарыстоўваеце пэўную вэрсію MediaWiki або вэрсію для распрацоўнікаў (галіна «майстар»), загрузка апошніх зьменаў параўнальна простая. Перайдзіце ў каталёг з вашым клонам MediaWiki і выканайце гэтую каманду:

git pull

Усе апошнія зьмены будуць дапасаваныя да вэрсіі, якую вы ўжываеце.

The new version of core may require newer versions of extensions and skins, so you must go into each extension and skin directory and update it with a command like git pull --recurse-submodules.

You also need to update vendor/ with any newer versions of required libraries. This often means running the following Composer command, but see #Fetch external libraries above for more details:

composer update --no-dev

Пасьля абнаўленьня коду і патрэбных бібліятэка вам трэба запусьціць сцэнар update.php MediaWiki з каманднага радку для абнаўленьня табліцаў базы зьвестак:

php maintenance/update.php

If you use MediaWiki-Vagrant , it offers a single command, vagrant git-update, that performs all these steps.

Пераключэньне на іншую вэрсію

Кожная з нашых вэрсіяў кантралюецца з дапамогай галінаў і цэтлікаў. Каб пераключыцца на адну зь іх (напрыклад, з галіны master на іншую галіну ці цэтлік), вам трэба зрабіць «checkout» пэўнай галіны або цэтліку з вашага каталёгу з клонам MediaWiki:

git checkout <branch_name>

або

git checkout <tag_name>

Зьмены будуць аўтаматычна захаваныя і ўсё будзе гатовае да працы.

Выкарыстаньне Git для спампоўкі пашырэньняў MediaWiki

Спампоўка пашырэньня

У наступных камандах <EXT> павінна быць замененая на назву пашырэньня, якое вы хочаце спампаваць, без прабелаў. Для Extension:TitleKey гэта будзе TitleKey (рэгістар важны!).

Спампаваць і зрабіць клон пашырэньня з Git:

With your developer account, use these commands to get the master branch:

cd /path/to/extensions
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/<EXT>

To clone and checkout a stable release branch instead, use these commands:

cd /path/to/extensions
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/<EXT> --branch REL1_41

You can view extension source code in Gerrit's gitiles application, and at the URL:

https://gerrit.wikimedia.org/g/mediawiki/extensions/<EXT>/+/HEAD


Спампаваць усе пашырэньні

Калі вы жадаеце загрузіць на свой кампутар усе пашырэньні MediaWiki, якія знаходзяцца на gerrit.wikimedia.org, зрабіце наступнае:

git clone https://gerrit.wikimedia.org/r/mediawiki/extensions

Or, to checkout stable releases branch instead, use this command:

git clone https://gerrit.wikimedia.org/r/mediawiki/extensions --branch REL1_41

After running the git clone command, continue with these commands:

cd /path/to/extensions
git submodule update --init --recursive

Каб у любы час абнавіць пашырэньні да іх апошняй вэрсіі на гэтай галіне, зрабіце:

cd /path/to/extensions
git pull
git submodule update --init --recursive

Каб пераключыцца на іншую галіну, напрыклад пасьля новага выпуску:

git submodule foreach 'git checkout -b REL1_40 origin/REL1_40 || :'

Remember that you should only use versions of extensions from the same release as that version of MediaWiki and each other.

To track the master branch:

git submodule foreach 'git checkout -b origin/master || :'

Please note that you should not use master code for production under any circumstances as it is not considered stable.

If you only need a read-only checkout (for instance to grep or analyse all MediaWiki code), you can use the shared MediaWiki checkout on Labs, without downloading anything on your machines.

Remove an extension

  1. Remove the "require_once …" or "wfLoadExtension( … )" from LocalSettings.php
  1. Remove any line referencing the extension in composer.local.json (usually in the "extra → merge-plugin → include" section)
  1. Remove the extension's directory in install-dir/extensions/

Выкарыстаньне Git для спампоўкі тэмаў афармленьня MediaWiki

MediaWiki вэрсіі 1.24 і пазьнейшыя не ўключаюць тэмы афармленьня ў загрузку з Git.

Follow the exact same procedure as for extensions (described in the previous section), but using skins rather than extensions in all URLs and paths.

Detailed installation instructions are available on each skin's page here on MediaWiki.org, for example see Skin:Vector#Installation. Instructions for all other skins are analogous.

Глядзіце таксама

Appendix

The Revision as of 14:26, 21 March 2019 changed the standard of linking to gerrit.wikimedia.org:

from:

gerrit.wikimedia.org/r/p/mediawiki

to:

gerrit.wikimedia.org/r/mediawiki