Category:MediaWiki
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:
(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/
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
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:
Subcategories
This category has the following 2 subcategories, out of 2 total.
Pages in category "MediaWiki"
The following 15 pages are in this category, out of 15 total.
