MediaWiki Lessons

From IML Wiki
Jump to: navigation, search

Chapter №1 system requirements and installing

Chapter №2 change logo, add dark theme, set up short address and robots.txt

  • change logo
  • The most popular special(system) pages

Special:AllPages Special:NewFiles

  • Lets delete SyntaxHighlight_GeSHi and add new Highlightjs extension for syntax code color

To standard uninstall extension needs deactivate it in "LocalSettings.php" file and delefe from "extensions/" filder.
To standard install extension needs install files to "extensions/" folder and activate in "LocalSettings.php" file.

Standard installing and uninstalling themes the same that for extensions, just folder is "skins/" not "extensions/", and except activating in "LocalSettings.php" file, you need to define it as default theme.

  • Set up short address

Task goal, you installed CMS MediaWiki on your server. You require to see next way URL-address:


But you can see next way:


How do you need delete this fucking "index.php"? (for Apache servers only)

1. First, create .htaccess file in the root website directory and make .htaccess next way:

RewriteEngine On
RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/index.php [L]

2. Then add into LocalSettings.php next line:

$wgArticlePath = "/$1";

3. Profit

  • Create and setuping Robots.txt file

After previous manipulation, your web site by default will be open without /index.php/, but if you force write it this way opened too. It's not bug, it's ok. But it's page duplicating which bad for SEO, so we need to create the robots.txt file for searching system bots, they don't need use index.php to.

User-agent: *
Disallow: /index.php

Chapter №3 create template

  • Create "Program" template and CSS styles for it

Template, for example, gives you the opportunity to make short info bar in right corner of your page
Eny of the template must include itself and CSS styles
All of templates which you have can see here: Special:UncategorizedTemplates
List of all CSS styles you can see here: MediaWiki:Common.css
To create new template, you need write next URL /sitename/Template:Program, where Program - it's name of your new template
MediaWiki will say, this template is not exist, but you can create one. Yes, create one.

<div class="Program">
<div class="Program-title">{{{title|{{PAGENAME}}}}}</div>
<div class="Program-logo">[[File:{{{logo}}}|300px]]</div>}}

Then open MediaWiki:Common.css page and create CSS styles for the this template.

.Program {
    background: #252525;
    border: 1px solid #aaa;
    float: right;
    margin: 0 0 1em 1em;
    padding: 1em;
    width: 400px;
.Program-title {
    font-size: 2em;
    text-align: center;
.Program-logo {
    text-align: center;
.Program th {
    text-align: right;
    vertical-align: top;
    width: 120px;
.Program td {
    vertical-align: top;

After that you can use this template in your wiki pages:

|title = {{PAGENAME}}
|logo = Blender-logo.png
|website =
|category = 3d modeling
|destination = creating 3d models
|license = free

Chapter №4 backup creating

  • Because MediaWiki uses files and database, you need to make backups each of them.
  • Important to do backup verification. Don't make backup only, check opportunity to restore your wiki website from it.

Chapter №5 update MediaWiki to new version, debugging

  • Download new MediaWiki archive and put new files on your old, already existing files needs overwrite.
  • Check required PHP version for new MediaWiki version, do the same for your extensions.
  • Next you need use SSH, oper your server, goto \maintenance and run next script
php update.php

which update MediaWiki structure, and database.

  • Debugging. If on some pages you see "internal error", usually after MediaWiki updating, needs to open LocalSettings.php file and add next line after first php tag is open
error_reporting( -1 );
ini_set( 'display_errors', 1 );

this code will write more information of your internal error
Quite possibly, that this error making from the Composer old version, then it will see like:

.../vendor/composer/ClassLoader.php on line 444

In this situation, you needs open server by SSH, goto .../vendor/composer/ and run next script

composer update

quite posible it says:

No composer.json in current directory, do you want to use the one at /home/.../yourSitename/vendor? [Y,n]?

choose "Yes"