Help:Configuration: Difference between revisions

From PBTWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
Configuration is largely carried out by editing the [http://www.mediawiki.org/wiki/Manual:LocalSettings.php LocalSettings.php] file in the MediaWiki directory: information on the general structure and how to edit it are available from the [http://www.mediawiki.org/wiki/Manual:LocalSettings.php LocalSettings.php MediaWiki Manual page].
Configuration is largely carried out by editing the [http://www.mediawiki.org/wiki/Manual:LocalSettings.php LocalSettings.php] file in the MediaWiki directory: information on the general structure and how to edit it are available from the [http://www.mediawiki.org/wiki/Manual:LocalSettings.php LocalSettings.php MediaWiki Manual page].
== User Rights ==
By default, anybody can add, create and edit individual pages or users.  '''This is bad news''': try deleting 3000 spam users and pages by hand...
In order to restrict who can do what to whom, the [http://www.mediawiki.org/wiki/Manual:User_rights User rights] need to be restricted by editing <code>LocalSettings.php</code>.
This involves adding lines setting the [http://www.mediawiki.org/wiki/Manual:$wgGroupPermissions $wgGroupPermissions array]
(more information on <code>$wgGroupPermissions</code> can be found on the [http://www.mediawiki.org/wiki/Manual:$wgGroupPermissions MediaWiki $wgGroupPermissions Manual page];
more information on User Rights is available on the [https://www.mediawiki.org/wiki/Manual:User_rights MediaWiki User Rights Manual page]).
These <code>$wgGroupPermissions</code> should be added after the various default settings in <code>LocalSetings.php</code>. 
Here is the relevant section from the HEP [[Main Page|PBTWiki]] <code>LocalSettings.php</code> file:
<pre>
## Set custom permissions
$wgGroupPermissions['*']['createaccount'] = false;
$wgGroupPermissions['*']['createpage'] = false;
$wgGroupPermissions['*']['createtalk'] = false;
$wgGroupPermissions['*']['edit'] = false;
$wgGroupPermissions['*']['move'] = false;
$wgGroupPermissions['*']['upload'] = false;
$wgGroupPermissions['*']['writeapi'] = false;
$wgGroupPermissions['*']['userrights'] = false;
$wgGroupPermissions['user']['edit'] = true;
$wgGroupPermissions['user']['upload'] = true;
$wgGroupPermissions['bureaucrat']['createpage'] = true;
$wgGroupPermissions['bureaucrat']['createtalk'] = true;
$wgGroupPermissions['bureaucrat']['move'] = true;
$wgGroupPermissions['sysop']['createaccount'] = true;
$wgGroupPermissions['sysop']['userrights'] = true;
</pre>
== Enabling Subpages ==


== Short URL ==
== Short URL ==
Line 29: Line 65:
</pre>
</pre>


In addition, the <code>$wgArticlePath</code> variable needs to be set in <code>LocalSettings.php</code>.   
In addition, the <code>$wgArticlePath</code> and <code>$wgUsePathInfo</code> variables need to be set in <code>LocalSettings.php</code>.   
The relevant part of the file looks like this:
The relevant part of the file looks like this:



Revision as of 15:26, 31 March 2016

Configuration is largely carried out by editing the LocalSettings.php file in the MediaWiki directory: information on the general structure and how to edit it are available from the LocalSettings.php MediaWiki Manual page.

User Rights

By default, anybody can add, create and edit individual pages or users. This is bad news: try deleting 3000 spam users and pages by hand...

In order to restrict who can do what to whom, the User rights need to be restricted by editing LocalSettings.php. This involves adding lines setting the $wgGroupPermissions array (more information on $wgGroupPermissions can be found on the MediaWiki $wgGroupPermissions Manual page; more information on User Rights is available on the MediaWiki User Rights Manual page).

These $wgGroupPermissions should be added after the various default settings in LocalSetings.php. Here is the relevant section from the HEP PBTWiki LocalSettings.php file:

## Set custom permissions
$wgGroupPermissions['*']['createaccount'] = false;
$wgGroupPermissions['*']['createpage'] = false;
$wgGroupPermissions['*']['createtalk'] = false;
$wgGroupPermissions['*']['edit'] = false;
$wgGroupPermissions['*']['move'] = false;
$wgGroupPermissions['*']['upload'] = false;
$wgGroupPermissions['*']['writeapi'] = false;
$wgGroupPermissions['*']['userrights'] = false;

$wgGroupPermissions['user']['edit'] = true;
$wgGroupPermissions['user']['upload'] = true;

$wgGroupPermissions['bureaucrat']['createpage'] = true;
$wgGroupPermissions['bureaucrat']['createtalk'] = true;
$wgGroupPermissions['bureaucrat']['move'] = true;

$wgGroupPermissions['sysop']['createaccount'] = true;
$wgGroupPermissions['sysop']['userrights'] = true;

Enabling Subpages

Short URL

The default page address for a MediaWiki installation looks something like this:

http://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php/Software/Geant4

However, what we would prefer is something like this:

http://www.hep.ucl.ac.uk/pbt/wiki/Software/Geant4

In order to do this, we have to modify the configuration to make use of Short URL's: details can be found on the MediaWiki Short URL Manual page.

Specifically, the configuration on the HEP www server makes use of Apache Rewrite Rules: a guide on setting up these short links is available from the MediaWiki Short URL/Apache Guide page.

Since it is not possible for individual users to edit the rules for the entire HEP website, the guidelines for setting up and individual .htaccess file were followed. A .htaccess file was created in the /unix/www/html/pbt/ directory: note that this is not the specific pbtWiki directory but one level above. This is simply a text file with the following lines:

## http://www.mediawiki.org/wiki/Manual:Short_URL/Apache

# Enable the rewrite engine
RewriteEngine On
 
# Short url for wiki pages
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/pbt/pbtWiki/index.php [PT,L]

In addition, the $wgArticlePath and $wgUsePathInfo variables need to be set in LocalSettings.php. The relevant part of the file looks like this:

## The URL base path to the directory containing the wiki;
## defaults for all runtime URL paths are based off of this.
## For more information on customizing the URLs please see:
## http://www.mediawiki.org/wiki/Manual:Short_URL
$wgScriptPath       = "/pbt/pbtWiki";
$wgArticlePath      = "/pbt/wiki/$1";
$wgUsePathInfo      = true;
$wgScriptExtension  = ".php";

This enables the PBTWiki to be accessed from the short URL.

CSS

Customised CSS rules can be used for pages within the PBT Wiki. To add or edit these rules, edit the MediaWiki:Common.css page.

More information on using CSS in a MediaWiki can be found at http://www.mediawiki.org/wiki/Manual:CSS