Talk:How to become a MediaWiki hacker

I think some detailed software component lists and version numbers would be useful for the target operational configuration and the "standard" development environment deemed best for neophytes.

More later after I read carefully and attempt some download and installation.

w:user:mirwin


 * version numbers have been addressed in the readme file at sourceforge w:user:mirwin

"You'll find cryptic instructions in the INSTALL file in the source. Try to follow them.

If you want to set up a local copy of the existing database to play with, first create an empty database with MYSQL and run the 'createdb.php' script in the 'maintenance' subdirectory (make sure it's configured appropriately!). Note that the maintenance scripts include files from the main source directory; either set up an include directory for PHP or just copy the files in."

Could someone please elaborate a little bit on this for someone who has never used PHP and MySQL before (and Apache only a few times)? More specific: mysqld and apache (with php4-module) are running (on MacOS 10.1.5) but I have no idea how to proceed from there. the wikipedia-software is in an subdirectory of my publicfolder (my test.php there is executed). mysqld is run as safe_mysqld by user "mysql". At the moment I get the following error:

"Warning: Failed opening 'Setup.php' for inclusion (include_path='.:/usr/lib/php') in /Users/elian/Sites/wikipedia/maintenance/createdb.php on line 6

Fatal error: Undefined class name 'title' in /Users/elian/Sites/wikipedia/maintenance/createdb.php on line 7"

What are the next steps to be done? What has do be configured now? --Elian


 * 1) Note that the maintenance scripts include files from the main source directory; either set up an include directory for PHP or just copy the files in. Simplest: copy everything in the 'maintenance' directory to the main source directory. Or, play with your php.ini and set up an include path.


 * I have no php.ini (this is macos x :-. The other solution worked.


 * 1) Create the database:
 * mysqladmin create wikidb #(You may need to use -u and -p options on mysql calls for root user)
 * (edit buildusers.sql to be have the desired database name, passwords)
 * mysql wikidb < buildusers.sql
 * 1) Set up the tables:
 * php createdb.php

Thanks, Brion. one step closer to the goal :-) wiki.phtml gets displayed now! There are some strange problems left (editing is possible in iCab but not in Mozilla and IE), but I try to solve them first alone ;-) --Elian

Everything works now except the upload of files. I suppose I have to tweak permissions a little bit. --Elian

Next question (sorry, just learning php, I have still some difficulties to understand the source code): update user set user_rights ='is_sysop' where user_name ='Test'; commit; but this change does not appear in the browser. What else do I have to add or to do? --Elian
 * How do I make a sysop? I tried:
 * How to switch everything to another language?

Sysops: it used to be "is_sysop" in phase II days, but now it's just "sysop". For developer access too (site locking, non-SELECT queries in the Asksql page), make it "sysop,developer".

Language: set the language code in LocalSettings.php, for instance for Esperanto:
 * $wgLanguageCode = "eo";

You'll probably also want to set the interwiki prefix if you're emulating or duplicating one of the per-language wikis:
 * $wgLocalInterwiki = "eo";

For Esperanto, Polish, Czech, Japanese, Korean, Chinese, Russian, or just for kicks, you'll want to configure it for utf-8 encoding also:
 * $wgInputEncoding       = "UTF-8";
 * $wgOutputEncoding      = "UTF-8";

To keep string functions like ucfirst from mis-munging utf-8 strings, I also set the locale:
 * setlocale(LC_ALL, "en_US.UTF-8");

I don't know if that's appropriate for non-Linux systems. Note that there should be some tweaks to the database configuration too, but we don't do them yet, so just ignore that for now. ;)

If you want to set up a language that doesn't have a LanguageXx.php file yet, make a stub one first! --Brion VIBBER 02:08 Nov 15, 2002 (UTC)

I am not {yet} a wikipedia hacker, but I have experience with Apache, PHP, Zope and ZWiki. I run a few ZWikis, frontended by Apache with mod_gzip enabled, which improves performance greatly, especially over high-latency or packet-lossy connections. Because most wiki pages are short plaintext, gzipped wiki pages can often be transmitted in 1 or 2 TCP/IP packets instead of many more for non-gzipped pages. A thought: if the wikipedia server has some CPU overhead, has anyone considered trying mod_gzip? -- Sydhart


 * Could be done... we could do this either with mod_gzip or PHP's gzip output filter (requires recompiling php with zlib support). About how much would this tend to affect CPU usage? --Brion VIBBER 04:40 Dec 10, 2002 (UTC)

Could someone explain how the edit conflict system works, ie what the wpEdittime variable is all about? I ask as I'm playing with a script I'm writing, which conceivably could create a nice gui interface for wikipedia editing (but at the moment I'm just playing). Thanks Smelialichu 18:41 Jan 9, 2003 (UTC)


 * When the edit form is generated, the wpEdittime field contains the timestamp of the last edit of the article (if it exists). When saving, it's compared with the current timestamp of the page, and if it's different, the edit conflict screen is given. --Brion 19:01 Jan 9, 2003 (UTC)


 * Thanks, so to stop coming up with the edit conflict I just need to submit the current value of wpEdittime with the rest? Smelialichu 19:09 Jan 9, 2003 (UTC)


 * Yup; you can grab it out of the edit form. Also, have you taken a look at Wikipedia Client & related pages? A more machine-friendly wiki interface would help things like this. --Brion 19:14 Jan 9, 2003 (UTC)


 * I have had a look through there. The machine friendly interface seems like a good idea (it isn't too hard to grab the needed info from the edit pages, but search, edit histories etc seems a bit more complex, and susceptible to breakage in the case of users using different themes, or a minor html change), but I'm certainly not up to writing anything to answer all the needs listedat Wikipedia Client. I'm just mucking about really, trying to hone my Python skills. But I guess due to python's reusable, and object oriented nature anything I did write could be useful, for the basic login, logout, post article functions anyway. Thankyou for your quick and helpful replies! Smelialichu 19:29 Jan 9, 2003 (UTC)

Has anyone managed to work with the codebase under windows? Advice would be much appreciated -- having problens with logging in with SSH -- Tarquin 18:50 Jan 27, 2003 (UTC)


 * For months I did all my work on it on a Windows 2000 box. I used the cvs and ssh that come with Cygwin. --Brion VIBBER 19:13 Jan 27, 2003 (UTC)

Help!

I have absolutely no knowledge of the software required to set up a wiki using Wikipedia soft whatsoever, neither the skills to learn it. But I do have a great desire to write an open project management standard, using this wiki (future project site: http://openPM.net). Volunteers are already lined up. I also have a commercial account with PHP and mySQL.

Could someone help me set up a wiki for that project?

Thanks, Mkoval


 * The Wikipedia software is under active development. It changes constantly, it's full of bugs, it has a lot of Wikipedia-specific things in the code that have to be changed for third-party use. I strongly discourage people from using it at the moment who aren't programmers and aren't interested in helping out with development.


 * That's not to say you shouldn't use it if you do have someone willing and able to babysit it and keep up with fixes and help with generalizing things. Just understand what you're getting into: this isn't a turnkey product, it's an experimental prototype that's being tweaked, improved, and occasionally scrapped and rebuilt. --Brion VIBBER 19:58 21 Apr 2003 (UTC)

becoming a hacker....
hi folks,

I've tried 'mysql -u wikiuser -p wikidb <table.sql' but mysql said: 'ERROR 2006 at line 45: MySQL server has gone away'.

Before I set up a user wikiuser with password and granted all permissions on wikidb.

What's wrong?

Thanks mark


 * This means that the connection to the server was broken, but doesn't tell you why. The server could have crashed (sometimes it will restart itself, which will be mentioned in the server's error log), or perhaps the connection timed out. Or, maybe it's just buggy.


 * If you're running an old (3.x) MySQL, consider upgrading to the current version. Try tweaking the configuration to increase the timeout value and the maximum packet size. --Brion VIBBER 03:08, 30 Nov 2003 (UTC)

problems importing mediawiki
Hi Folks again,

Thank you, Brion, for your hints. Here is my state:

I'm running mysql 4.0.16-nt (up to date recommended production release) on win xp.

Now I copied the contents of my-huge.cnf to WinMySQLadmin's "my.ini setup"-field, assured that no information is double and saved the modifications. Then I restarted the mysql daemon.

The values from my-huge.cnf must be large enough, but on 'mysql -u wikiuser -p wikidb <table.sql' mysql said again: 'ERROR 2006 at line 45: MySQL server has gone away'.

Hmm. Any suggestions? Thank you all. Mark


 * The server writes out to an error log which might have more useful information that isn't being reported to the client. In a Unix installation this would be in /usr/local/mysql/var or similar... Can you check this? --Brion VIBBER 22:17, 1 Dec 2003 (UTC)

tar and unzip
Somewhere here the unzip and tar commands used to unpack the .tar.gz file needs to be explained... it's hard to look at the INSTALL with it's cryptic installation guide without getting past first base... would someone please add the appropriate commands for doing that to the main article.

I figured out that you could use Winzip to unzip the .gz part, but I don't really feel like reading the man pages on tar tonight.

Sometimes it seems that open source people forget that there are many talented programmers out there that don't know much about CVS, tar, and gz files... let's lower the bar for entry.

Ok, feeling a teensy bit sheepish, I figured out something useful... if you take the tar[1] extension and make it just .tar, then Winzip can figure it out and deal with extracting tar.

Still, it would be nice to have the command line for unix spelled out.


 * The last time I opened a .tar.gz in WinZip it helpfully offered to open the .tar archive after decompressing it. However I haven't used WinZip much in a long long time, it may have changed behavior. Could you explain what "the tar[1] extension" means? It occurs to me that your browser may be screwing you over by renaming the file in strange ways as it downloads. What browser are you using?


 * Anyway, typical tar command line:
 * tar zxvf mediawiki-1.1.0.tar.gz
 * Hooray for cryptic 1970s-era command lines! --Brion VIBBER 11:34, 4 Jan 2004 (UTC)

SQL dumps
Then, once you've got the SQL dumps for the language you want, import them like so:

That's only if you're trying to create a clone of wikipedia, right? If you're just wanting to set up a blank encyclopedia project you'd skip this step, right? 170.35.224.64 20:09, 10 Mar 2004 (UTC)

Command line user creation
I'm trying to set up a shell script that will create Wiki users, and it seems it should just be a simple matter of MySQL insertions. However, I can't get the passwords to hash correctly. I've looked at the functions in User.php but I'm afraid I don't completely understand them.

What would be the best way to accomplish this? 67.171.79.204 13:12, 24 Aug 2004 (UTC)

First Hack (+ Problems)
I did my first very basic own hack today. Before to release it on the main entry i want to present it here hopefully some questions got anserwed and some hints added.

Add the Special Page "FirstTry"

 * 1. Open the file SpecialPage.php in the include dir and insert a new line into the $wgSpecialPages Array with the value "FirstTry" in both fields.
 * 2. Create a new file called SpecialFirstTry.php in the include dir.
 * 3. Insert into this File the function wfSpecialFirstTry and make $wgOut global to use the wiki-output.
 * 4. Now use the function addHTML of the $wgOut class to do a basic output. $wgOut -&gt; addHTML("Hello World");
 * 5. Go to Our Special Pages an Enjoy :)

Failures and next Steps
Pfew. Im not sure that there is not allready a Hack Guide into the wide wiki area. In this Case please tell me where!

In case that not the guide need some class infomations next so that a user can use this global classes and do not do all this sql and output stuff by own code.

Another problem i could not fixed was this < > problem on the displayed title. I realy dont found it !!

tharo@bahamut.de

Lost connection --- suggestion
I often encounter this:

A database error has occurred Query: SELECT cur_id FROM cur WHERE cur_namespace=0 AND cur_title='King_of_England' Function: LinkCache::addLink Error: 2013 Lost connection to MySQL server during query

Backtrace: Database.php line 196, in wfdebugdiebacktrace DatabaseFunctions.php line 36, in database::query LinkCache.php line 136, in wfquery Title.php line 595, in linkcache::addlinkobj Skin.php line 1480, in title::getarticleid Parser.php line 1280, in skincologneblue::makelinkobj Parser.php line 810, in parser::replaceinternallinks Parser.php line 98, in parser::internalparse OutputPage.php line 226, in parser::parse refreshLinks.inc line 35, in outputpage::addwikitext rebuildlinks.php line 29, in refreshlinks

It would be pretty easy to change the code to reconnect to the database if the connection is lost and resume rebuilding the links, since it's a long process of updating the links, restarting is usually a pain.

How to add keywords for meta tags in HTML Header
How can I add keywords for meta tags in HTML Header? I have found no way to do so and there seems to be a mechnaism automatically picking some words from the page, which results in confusing keywords.

thx, marc