How to become a MediaWiki hacker/sr
Language: | English • Deutsch • Français • Bahasa Indonesia • 日本語 • Occitan • Polski • Português do Brasil • Српски / Srpski • Türkçe • 中文 |
---|
Ова страна ће покушати да прикупи информације о процесу развоја МедијаВикија и да одговори на питање новопридошлих програмера (developers). Ако желите да нам помогнете у кодирању, али још увек не поседујете неопходне вештине, ово је добро место за почетак.
Прво, неке пресудне повезнице:
- Веб страна Википедијиног кода садржи опште информације о развоју
- Википедијина страна пројекта на Сорсфорџу (SourceForge) вам омогућава да преузмете код и пријавите грешке. Приметите да ми не користимо Сорсфорџов пратилац закрпа (patch tracker) (ако не знате шта су закрпе, погледајте доле).
- Листе слања (mailing list): wikitech-l за развој, mediawiki-l за подршку, mediawiki-cvs за обавештавање о CVS-у
- MediaWiki architecture има још документације!
Ја мењам мој МедијаВики. Да бих следећој јадној луди ублажио криву учења, документујем шта ја радим и како све то функционише. Имам и кратке текстове о PHP-у, PHPTAL-у, MySQL-у, CSS-у и МедијаВикију и о томе како се слажу једни с другима. Такође, и корак-по-корак опис о томе како сам учио шта да мењам.
Погледајте и моје забелешке о програмирању.
Contents |
[edit] Оперативни системи
МедијаВики софтвер је писан у PHP-у и користи MySQL базу података. И једно и друго је прерађено (ported) за разне оперативне системе укључујући, али и не стајући на, већину варијанти Уникса и Микрософтов Виндоус. Стога је могуће инсталирати и користити Википедију на оба система. Знајте да ако користите Виндоус, неке могућности које укључују вањске алате вам неће бити доступне, или ће бити доступне уз додатно преузимање (download) и подешавање. Повремено се уоче и грешке специфичне за поједине оперативне системе па је најбоље имати и неко знање о разликама између разних платформи, без обзира на којем оперативном систему вршите развој.
[edit] Програмски језик PHP
Уколико не познајете језик PHP (то му је скраћено од "PHP: Hypertext Preprocessor") али вам је познато програмирање у неком другом објектно-оријентисаном језику, без панике, PHP ће бити лаган за учење.
Ако не знате ни PHP нити неки други објектно-оријентисани програмски језик, требало би да се упознате са концептима класa, објекaта, метода, догађаја, наслеђивања...
Не знате ниједан програмски језик? PHP је сасвим добар језик за почетак, прилично једноставан у односу на друге модерне језике (иако је специфичан по начину извршавања програма).
За разлику од већине програма, PHP скрипте се обично не покрећу из командне линије или из (window manager - kontekst mi je nejasan...). PHP скрипт се извршава при позиву фајла с Веб сервера, с ".php" екстензијом. Када се то деси, Веб сервер (у нашем случају Апач) позива PHP интерпретер (уграђен у сам Веб сервер) који извршава инструкције из PHP фајла и враћа резултат браузеру. Сам PHP фајл може истовремено да садржи и обичан HTML и PHP код, што га чини прилично једноставним алатом за додавање динамичке функционалности на веб странице.
За даље читање:
- PHP тутор (доступан у великом броју језика - где је линк за српску страницу???)
- PHP мануал (доступан у великом броју језика - али не и на српском, колико ми је познато)
- PHP wiki (German)
- wikibooks:PHP
[edit] SQL и MySQL
Wikipedia currently uses MySQL as the database backend. Make sure MySQL support is compiled into PHP!
We're also trying to make the wiki work with other database backends, particularly postgresql, out of performance and portability concerns.
[edit] Инсталација МедијаВикија
On how to get the sources from CVS see MediaWiki from CVS.
You'll find instructions in the INSTALL file in the source. Try to follow them. You could also try checking out MediaWiki User's Guide: Installation.
It's not necessary to download Wikipedia database dumps in order to develop MediaWiki features. In fact, in many cases it's easier to use a near-empty database with a few specially crafted test pages. However, if for some reason you want to have a copy of Wikipedia, you can get a dump from SQL dumps Import them like so:
- Linux
- gzip -dc cur_table.sql.gz | mysql -u wikiadmin -padminpass wikidb
- gzip -dc old_table.sql.gz | mysql -u wikiadmin -padminpass wikidb
- cd maintenance ; php rebuildall.php
- Windows (may need -u wikiadmin -padminpass wikidb as above)
unzip the file
- mysql < cur_table.sql
- mysql < old_table.sql
- cd maintenance ; php rebuildall.php
NOTE: In previous versions, the script to rebuild links was different, i.e.
- cd maintenance ; php rebuildlinks.php
You may also find that you get an error complaining that access was denied to the wiki database. Make sure that you have created a file AdminSettings.php in your top level MediaWiki install directory (the same place as LocalSettings.php is found). An AdminSettings.sample file is provided for you to customise - make sure your MySQL administration username and password is set correctly. See Manual:Upgrading for more details.
Rebuilding the link tables may take a long time, particularly if you've installed the English database, which is quite big. (Note also that you can skip the old table if you wish.) See Database layout on what rebuildall.php is good for.
Note that if you want to create a public mirror of Wikipedia, this probably isn't the best way to go about it. If you do set up a mirror this way, please tweak the code to note that you're looking at a mirror and include links back to the main site.
[edit] Кодна база МедијаВикија
The MediaWiki codebase is large and ugly. Don't be overwhelmed by it. When you're first starting off, aim to write features or fix bugs which are contained to a small region of code.
See also: (generated documentation)
The best way to learn about MediaWiki is to read the code. Here are some starting points:
- index.php is the main entry point, although where things go from there is not very obvious.
- Article.php contains code for page view, delete, rollback, watch and unwatch. It also contains some general utilities for dealing with articles, such as fetching a revision or saving a page.
- EditPage.php has about half of the code related to editing, the half that's close to the user interface. The rest is in Article.php and the various *Update.php files.
- Parser.php has most of the code that converts wikitext to HTML. A few bits and pieces are in Skin.php
- Linker.php has functions to generate the HTML for links and images
- Code for most special pages is in the Special*.php files.
- Database.php contains stacks of functions for accessing the database.
- OutputPage.php is the home of the OutputPage class, which is an output buffer. Send your text here and it will be sent to stdout just before the script exits.
- Title.php is all about titles -- and that includes interwiki titles and "#" fragments. There's some functions in here that will fetch information about an article from the database.
- User.php contains the User class, which represents user preferences and permissions.
- Setup.php does all sorts of initialisation, and seems to account for a large proportion of running time. Among other things, it initialises lots of global variables, mostly containing objects.
- DefaultSettings.php contains defaults for lots of global variables, which may or may not be overridden in LocalSettings.php. Don't use isset(), always add a default for any global variable you introduce.
[edit] Ваша прва особина
Here are some ideas:
- Code something that interests you.
- Code a simple crowd-pleasing feature, an aesthetic improvement.
- Write a special page to provide some handy information. You can even make a modular special page, there's examples in the extensions directory, and the extensions module.
- Write a parser hook, see Write your own MediaWiki extension for more information
- Fix an annoying little bug that nobody else could be bothered with
For more specific ideas, please come and talk to the developers on #mediawiki. Don't be put off for a lack of ideas. We have enough ideas between us to keep half a dozen programmers busy for a year.
It's a good idea to talk to a senior developer (e.g. Brion or Tim) on #mediawiki before you start, especially if you're not sure how your feature will affect other parts of the code.
When you have a feature ready to go, press for CVS write access, so that you can commit it. Posting patches can be frustrating, although you may have to do it once or twice to demonstrate good faith. Before you commit your feature, make sure it can be disabled easily.
Don't ask for shell access to the Wikimedia servers. There is no way to restrict shell access to some sort of sandbox, so shell access is only given to people who we really trust. It pains us to turn people down, but often we must. Wait until it is offerred, or if it's taking a long time, discreetly test for support.
See also: Development policy