Working with MediaWiki
 Vicente González Ruiz
September 12, 2016
    
   Contents
   
   MediaWiki is a free-software open-source package written in PHP and originally
for use on Wikipedia as Wiki engine. It has been licensed under the GNU General
Public License.
   A Wiki is a Website that allows the creation and editing of any number of
interlinked Web pages via a Web browser using a simplified markup language or a
WYSIWYG text editor. The first Wiki (titled WikiWikiWeb) was developed by
Ward Cunningham in 1994.
   The Wikipedia is the largest and most famous MediaWiki site.
                                                                  
                                                                  
   0.1    Possibilities
Ward Cunningham comments that the main characteristics of a Wiki are:
     
     - Users can create Wiki pages or modify existing ones by means of
     a plain Web browser. An user can be everyone that have access to the
     Web server where the Wiki pages are stored. Usually, users are required
     to register in order to have editing capabilities (although this is optional).
     
- Users can collaborate in the task of developing the Wiki pages
     and no hierarchy nor priorities between users are defined. In
     this sense, a Wiki is (by default) completely open to everybody that have
     something to say related to the Wiki’s matter.
     
- Every modification in the Wiki is registered and traced. By means
     of this characteristic, it is possible to know who has performed an action
     and when. User registering can be mandatory in some Wiki sites for this
     reason.
     
- The massive collaborating possibilities of a Wiki can produce
     excellent document resources in a record time. Therefore, some
     people have compared the Wiki pages to “living organisms” that evolves
     and adapt to the requirements of the Wiki users.
Lets check if these possibilities are true!
   0.2    Installation and basic configuration
                                                                  
                                                                  
   
# This installation only works in Debian and Debian based
 
# Linux distributions, such as Ubuntu.
 
 
# Install the LAMP (Linux, Apache2, MySQL, PHP) server.
 
sudo tasksel install lamp-server
 
#
 
# You will be asked for a new password for the MySQL administrator
 
# (named "root"). Remember this password because you’ll have to
 
# configure the MediaWiki with this username (and its password)
 
# instead of the default user "wikiuser".
 
#
 
 
# Install MediaWiki.
 
sudo apt-get install mediawiki
 
 
# Uncomment the alias "/mediawiki" in the file
 
# "/etc/mediawiki/apache.conf". By means of that, Apache will serve
 
# the PHP pages of MediaWiki which are stored in the
 
# "/var/lib/mediawiki" directory.
 
sed -e "s/#Alias/Alias/g" /etc/mediawiki/apache.conf > /tmp/1
 
sudo mv /tmp/1 /etc/mediawiki/apache.conf
 
 
# Restart apache.
 
sudo /etc/init.d/apache2 restart
 
 
# Try MediaWiki.
 
firefox http://localhost/mediawiki
 
 
# As you can see, it is neccesary to configure MediaWiki before use it.
 
# In general, don’t change anything at least you know that are you doing.
 
# You have to answer only to the name of the Wiki site ("test", for example),
 
# the password of the MediaWiki administrator ("WikiSysop") and
 
# the MediaWiki username ("wikiuser") that must be "root" and its password that
 
# must coincide with the one given in the configuracion of MySQL.
 
# Finally, push in the "Install MediaWiki!" button.
 
#
 
# Anyway, notice that this configuration can be re-done visiting again:
 
#
 
#   http://localhost/mediawiki/config/index.php
 
 
# Move the temporal config file to its definitive place.
 
sudo mv /var/lib/mediawiki/config/LocalSettings.php /etc/mediawiki/
                                                                  
                                                                  
 
 
# Finally, follow the link to "http://localhost/mediawiki/index.php"
 
# to check that the MediaWiki has been installed.
 
 
# See:
 
#
 
#        https://help.ubuntu.com/community/MediaWiki
 
#
 
# for extra information about the installation of MediaWiki under Ubuntu.
   0.3    Removing MediaWiki
If during the installation something was wrong, you can erase the installation of the
previous packages and re-install them. Just try:
                                                                  
                                                                  
   
sudo tasksel
 
# And unselect the "LAMP server" entry. Next, push "<Ok>".
 
sudo apt-get remove mediawiki
 
# After that, if you are goint to re-install lamp-server,
 
# it is recommended that you reboot your host to clear the
 
# related environment variables and temporal files that
 
# could remain defined.
   0.4    How do I access to the Wiki site?
In general, Wikis can be read and modified by any Web surfer. The only thing you
really need is the URL of the Wiki. In our example:
                                                                  
                                                                  
   
firefox http://localhost/mediawiki
   You should know that some Wiki administrators configure their sites in a way
that only those users than are registered can modify the contents of the pages. In any
case, user registering and log-in is important to record the activity of the users in the
Wiki. Typically, no special requirements such as valid e-mail addresses will be
required.
   0.5    How do I create a new page?
When the MediaWiki engine has been installed and configured, an user can create a
new page using two ways:
     
     - Specifying   a   new   URL   in   the   Wiki   site.  For   example,
     after   the   installation   of   MediaWiki   in   our   host,   if   we   browse
     http://localhost/mediawiki  we   will   automatically   redirected   to
     http://localhost/mediawiki/index.php/Main_Page.   If   we   change
     “Main_Page” by whatever other string, we will created a new Wiki page
     after clicking on the “create” link.
     
- Defining in the current page a new link to the page that we want
     to create and then clicking on the red link which appears.
   0.6    Page structure
Although Wiki pages are fully configurable, by default, there are two main versions of
a page:
     
     - The Page (or Article) version that usually has the “definitive” content.
     
- The Discussion version in which users talk about the contents of The
     Page. This is similar to an off-line chat.
   For each of the two versions of the page, there are four actions (or links) that can
be followed:
     
     - Edit: to edit the page.
     
- History: to see a different version of the page and who has created that
     version.
     
- Move: to change the URL of the page.
     
- Watch-list: to label this page as “watchable”. This means that if the page
     is modified, an e-mail will be sent to the user.
   0.7    Page syntax
The Wiki pages are written in a lightweight markup language typically known as
Wikitext language or Wiki Markup, although LaTeX code can be inlined for defining
the formulas. Their ultimate purpose is to be converted by the Wiki engine into
HTML, which is the language that understand Web browsers.
   The next subsections show how to create the content a Wiki page. Obviously, we
need first a empty page. Please, create a new page following the instructions given in
Subsection 0.5.
Writing plain text
                                                                  
                                                                  
   
This is plain text.
 
 
This is more text in a different line.
 
 
Note that these lines are not indented!
Defining subsections, paragraphs and so on ...
                                                                  
                                                                  
   
=This is a subsection=
 
==This is a paragraph==
 
===This is a subparagraph===
 
====This is a subsubparagraph====
 
=====One sub...subsection more!=====
Bold and italics
                                                                  
                                                                  
   
’’italic text’’
 
’’’bold text’’’
 
’’’’’bold italic text’’’’’
Mathematics
   As you can see in the Wiki editor, it is possible to write mathematical expressions
using the LaTeX syntax. In order to do this, you have to install:
                                                                  
                                                                  
   
sudo apt-get install mediawiki-math
 and verify that the line $wgUseTeX = true; is in /etc/mediawiki/LocalSettings.php,
obviously uncommented.
   Once this is done, try to introduce in your Wiki page the following code:
                                                                  
                                                                  
   
<math>\frac{\sqrt{\frac{x^2}{\log_2(\sin(x))}}}{\sum_{i=1}^n e^x}</math>
Links between Wiki pages in the same server
   Create a new Wiki page called new_page_2. Return to the previous one and write
in it:
                                                                  
                                                                  
   
This is a link to the Wiki page [[new_page_2]].
 Save the changes and a link from the first page to the second one will appear.
Links to other Web pages
                                                                  
                                                                  
   
This is a link to an external Web or Wiki page [http://www.google.com Google]
Verbatim text
                                                                  
                                                                  
   
 This is verbatim text, very useful to write source code, for example.
 
 Notice the space at the begining of each line!
Indentations
                                                                  
                                                                  
   
This is aligned all the way to the left.
 
: This is indented slightly.
 
:: This is indented more.
Bullet pointed items
                                                                  
                                                                  
   
* First list item.
 
* Second list item.
 
** Sub-list item under second.
 
* Third list item.
Enumerated items
                                                                  
                                                                  
   
# First item.
 
# Second item.
 
## Sub-item under second item.
 
# Third item.
   0.8    User access levels
The status of a user in a MediaWiki server depends on the number of identification
stages that the user has performed in that server. These are the possibilities:
     
     - Unregistered: Those users that are not logged in the Wikipedia.
     
- Logged in: Those users that have created an account and logged in.
     
- Autoconfirmed: Those users that have an account with more than four
     days old and have made at least 10 edits.
     
- Confirmed: Those users that have an account and have been confirmed
     by the Wiki administrator.
In some Wiki sites such as the Wikipedia only the autoconfirmed and confirmed users
can modify the contents.
   0.9    Dealing with audio, image and video
Wiki pages that are served by any MediaWiki engine can reference multimedia
content. All multimedia files have to be stored in a MediaWiki server (for example,
the images, sounds and videos used in the Wikipedia are stored in the Wikimedia
Commons online repository).
                                                                  
                                                                  
Uploading a new media file
   File uploading in our local host MediaWiki server is performed through the
URL:
                                                                  
                                                                  
   
http://localhost/mediawiki/index.php/Special:Upload
   Only logged in users are capable of upload media files. Anyway, if you tray it and
get a “File uploads are disabled” error, the Web server administrator have to enable
file uploading first (see Subsection 0.9). Otherwise, a Web form will allow you to
upload a file to the server.
Enabling file uploading
   By default, file uploading to a new MediaWiki server maybe is disabled. To
enable it, as Web server administrator, the following actions have to be
performed:
     
     - Make sure uploads are enabled in PHP. In our server (under Ubuntu),
     check that the file
                                                                  
                                                                  
     
     /etc/php5/cli/php.ini
  has the line file_uploads = On uncommented and that the file
                                                                  
                                                                  
 
     /usr/share/mediawiki/LocalSettings.php
  has the line $wgEnableUploads=true inside it, obviously uncommented
     too. 
   By default, only the extensions .png, .gif, .jpg and .jpeg are allowed for the
uploads (and, as you can see, all of them are image containers). If you need to
support different media data, such as audio or video, you have to modify the content
of the $wgFileExtensions in the file LocalSettings.php. For example, if you
write:
                                                                  
                                                                  
   
$wgFileExtensions[] = ’avi’;
 
$wgFileExtensions[] = ’ogg’;
 .avi and .ogg files will be supported also.
   At any case, notice that your Web browser must support this kind of media data
and containers if you want to reproduce it.
Listing previously uploaded images
   It is possible to watch what media files are stored on your server using the
URL:
                                                                  
                                                                  
   
http://localhost/mediawiki/index.php/Special:ListFiles
Referencing media files
   For example, to reference the image Lena.png what has been previously uploaded
to the Wiki server, we can write in the Wiki page:
                                                                  
                                                                  
   
[[File:Lena.png|Lena is a very famous image!]]
 
[[File:Lena.png|thumb|This is a thumbnail version on lena]]
   0.10    Protecting pages
Some Wiki pages need some kind of protection against vandalism. The MediaWiki
administrator can protect a page to restrict editing or moving that page, and of
course, remove such restriction. Protection can be indefinite, or expire after a
specified time. When you are logged in the Wiki site as administrator, the “protect”
link is available for every page you visit.
   Notice also that there are two levels of protection:
     
     - Full  protection:  a  fully  protected  page  can  be  edited  only  by
     administrators.
     
- Semi-protection: semi-protected pages can be edited only by registered
     users that have been confirmed.
   0.11    Resolving conflicts
Wiki pages can be edited currently by several users. Therefore, an edit conflict could
arise in the following situation:
     
     - User-1 edits page X.
     
- User-2 edits the same page X.
     
- User-1, after modifying the page, “saves” the page.
                                                                  
                                                                  
     
- User-2, after modifying the page, try to save it but the system says to
     User-2 that he has an “edit conflict” because the Automatic Conflict
     Resolver 
     can not merge his changes with the User-1’s ones.
   In this points, there are two solutions:
     
     - User-2 reloads the actual version of the page X (those that User-1 has just
     generated) and extremely fast makes the modifications that he want and
     save it. Obviously, this is not a useful solution!
     
- User-2 uses a conflict page to reconcile the differences between his version
     of the page and the User-1’s one. Again, it is only responsibility of the
     User-2 the resolution of his conflicts.
   As you can deduce, it is very recommendable that users that are editing a page
perform the saving-and-reload operation of that page several times, basically after
any minor edition, in order to make easier the work of the automatic conflict
resolver.