From charlesreid1

Installation

The instructions at http://mediawiki.org are really straightforward. All you have to do is unzip the MediaWiki tarball/zip file into your web server's main directory. Their recommendation is to put it in a folder called w/, and I recommend following their recommendation.

Permissions

Changing Namespace Permissions

This is a handy way for you to create custom permissions for parts of your wiki.

Step 1: Select Protected Namespace

This step consists of either selecting an existing namespace to protect, or creating a new namespace.

I will use the example of the "Secret" namespace. As an example, on a public wiki the page [[Message]] would be open to the public, and viewable by anyone. But if this were added to the Secret nanemspace, i.e. if it were at [[Secret:Message]], then it would only be viewable by those with permission to view the Secret namespace.

Add the new namespace to LocalSettings.php with the following code:

$wgExtraNamespaces = array( 100 => "Secret");

If you want to create more namespaces, you can number them 101, 102, 103, etc., or really, whatever you feel like. (Just keep the numbers big so they don't interfere with existing namespaces.)

Step 2: Modify includes/Title.php

The file includes/Title.php is a header file that is included on all MediaWiki pages. When pages are loaded, the load request is processed through Title.php.

Look for the piece of code that looks like this:

        if( $wgUser->isAllowed( 'read' ) ) {
            return true;
        } else {
            global $wgWhitelistRead;

This piece of code checks if a user has global "read" permissions, and if so, it proceeds to load the page.

We will create a new permission called "read_secret" that, if a user has, will allow them to see any page in the Secret namespace.

Add a check for the new "read_secret" permission:

        if( $this->getNamespace() == 100 ) { 
            //this is "Secret" namespace
            return $wgUser->isAllowed('read_secret');
        }   
        if( $wgUser->isAllowed('read') ) {
            return true;
        } else {
            global $wgWhitelistRead;

Step 3: Create a group with the new permission

The next step is to create a MediaWiki group that will have the just-created permission, "read_secret". I'll name this group something really creative like "secret":

$wgGroupPermissions['secret']['read_secret'] = true;

Step 4: Add users to new group

The last step is to add users to the new group. You can go to the page Special:UserRights on your wiki, and it will prompt you for a user. Once you enter a user's name, you will see a list of groups that are available to add a user to:

MWGroups.png

(Of course, this will depend on your wiki's configuration. Also, you have to be an administrator or a bureaucrat to add users to new groups.)

You can check the "secret" box, and the user will now be a member of the group "secret" and have the permission "read_secret", making him or her able to access pages in the Secret namespace!

Extensions

20 MediaWiki extensions that are pretty handy: http://blog.fedecarg.com/2008/03/08/20-mediawiki-extensions-you-should-be-using/

Math

I was having a lot of trouble getting the MediaWiki Math extension to work. I kept seeing the following error:

"Failed to parse (PNG conversion failed; check for correct installation of latex, dvips, gs, and convert)"

Here's how I resolved it:

Step 1: Install all the crap you need

# this is the "easy way" and is preferable
sudo apt-get install mediawiki-math

# this is the "manual way" and may not work
sudo apt-get install ghostscript imagemagick dvipng texlive-latex-base texlive-latex-extra

Step 2: Fix texvc

For me, I found the main problem was that I didn't have texvc. This page http://www.mediawiki.org/wiki/Texvc suggested installing mediawiki-math using aptitude, which the above instructions should help take care of.

Step 3: Test

You should be able to run the following command line and see some HTML:

$ texvc /tmp/junk /tmp/junk "y=x+2"
Cdaa63ef966cc412541190bc8794731de<i>y</i> = <i>x</i> + 2<mi>y</mi><mo>=</mo><mi>x</mi><mo>+</mo><mn>2</mn>-

And voila!

ArticleComments

I installed the Article Comments extension from here: http://www.mediawiki.org/wiki/Extension:ArticleComments

Once you install it, you can add a comments form for feedback by adding the following to the wiki page:

<comments />

Errors

I had some troubles that weren't addressed by this extension's page, they looked like this:

Warning: Missing argument 2 for wfArticleCommentsAfterContent()in /path/to/ArticleComments.php on line 207

This was fixed following [1]:

 - function wfArticleCommentsAfterContent( $data, $skin ) {
 + function wfArticleCommentsAfterContent( &$data ) {
 -      global $wgRequest, $wgArticleCommentsNSDisplayList;
 +      global $wgRequest, $wgArticleCommentsNSDisplayList, $wgUser;

        # Short-circuit for anything other than action=view or action=purge
        if ( $wgRequest->getVal( 'action' ) &&
                $wgRequest->getVal( 'action' ) != 'view' &&
                $wgRequest->getVal( 'action' ) != 'purge'
        )
        {
                return true;
        }

        # Short-circuit if displaylist is undefined, empty or null
        if ( $wgArticleCommentsNSDisplayList == null ) {
                return true;
        }

 +      $skin = $wgUser->getSkin();
        $title = $skin->getTitle();
        if ( !$title->exists() ) {
                return true;
        }

Moving MW From One Server To Another

Step 1: Set Up SQL

First step is NOT to copy everything from the original wiki to the clone wiki

The first step is to download mediawiki and install it like you would normally, but paying close attention to match the SQL settings in the original wiki's LocalSettings.php

This will then set up the necessary SQL framework.

You can throw away the new wiki you've set up, since the main point is to have MediaWiki create an empty SQL database with the right structure.

Step 2: Copy Apache Files

At that point you copy the original wiki to the clone wiki (at least, all the apache FILES)

Step 3: Copy MySQL

Last step remaining is covered on MySQL page: copy the actual database from one MySQL server (original wiki) to the other (clone wiki).

BTW... to restart MySQL server: sudo service mysql restart

had to do that after changing config file to make mysql open to public

(not necessary, actually)

also covered on MySQL page


Skinning Mediawiki

This article is located at the Skinning MediaWiki page.

I have created two skins, along with explanations: