Help:Configuration: Difference between revisions
SimonJolly (talk | contribs) No edit summary |
SimonJolly (talk | contribs) No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
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 and Groups == | |||
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> | |||
Taking the line <code>$wgGroupPermissions['user']['edit'] = true;</code> as an example, each line consists of three parts: the name of the group (<code>'user'</code>), the user permission to modify (<code>'edit'</code>) and the Boolean value used to set the permission in question (<code>true</code>). | |||
So in this case, anybody in the <code>'user'</code> group is allowed to edit pages. | |||
An asterisk, <code>'*'</code>, in the user group means that the permission applies to all groups; so in the case of the code above, the line <code>$wgGroupPermissions['*']['writeapi'] = false;</code> means that nobody can create APIs. | |||
Subsequent permissions will override earlier ones, so the line <code>$wgGroupPermissions['sysop']['createaccount'] = true;</code> means that anyone in the <code>'sysop'</code> group can create accounts, overriding the <code>$wgGroupPermissions['*']['createaccount'] = false;</code> line. | |||
For a list of all the default groups available, see the [http://www.mediawiki.org/wiki/Manual:User_rights#List_of_groups List of groups section] on the [http://www.mediawiki.org/wiki/Manual:User_rights MediaWiki User Rights Manual page]. | |||
For a list of all the permissions that can be modified and their default settings, see the [http://www.mediawiki.org/wiki/Manual:User_rights#List_of_permissions List of permissions section] on the [http://www.mediawiki.org/wiki/Manual:User_rights MediaWiki User Rights Manual page]. | |||
Changing the group that each user is a member of is carried out through the [[Special:UserRights|Special:User Rights]] page. | |||
To list all users, see the [[Special:ListUsers|Special:User List]] page. | |||
== Subpages and Namespaces == | |||
Subpages introduce some hierarchical organization into wiki pages, with levels of the hierarchy separated by slashes (<code>/</code>). | |||
More information on Subpages is available on the [http://www.mediawiki.org/wiki/Help:Subpages MediaWiki Subpages Help page]. | |||
Enabling subpages involves modifying the settings in <code>LocalSettings.php</code> that correspond to the associated [http://www.mediawiki.org/wiki/Manual:Namespace Namespace]. | |||
A [http://www.mediawiki.org/wiki/Manual:Namespace Namespace] is a collection of pages which have content with a similar purpose, i.e. pages where the intended use is the same. | |||
More information on Namespaces can be found on the [http://www.mediawiki.org/wiki/Manual:Namespace MediaWiki Namespace Manual page]. | |||
A number of default Namespaces are available: the full list can be found in the [http://www.mediawiki.org/wiki/Manual:Namespace#Built-in_namespaces Built-in Namespaces section] of the [http://www.mediawiki.org/wiki/Manual:Namespace MediaWiki Namespace Manual page]. | |||
It is possible to add custom Namespaces: however, only the default ones are used for the [[Main Page|PBTWiki]]. | |||
Subpages are enabled for specific Namespaces by setting the <code>[http://www.mediawiki.org/wiki/Manual:$wgNamespacesWithSubpages $wgNamespacesWithSubpages]</code> array in the <code>LocalSettings.php</code> file: for more information see the [http://www.mediawiki.org/wiki/Manual:LocalSettings.php#Enabling_subpages Enabling Subpages section] of the [http://www.mediawiki.org/wiki/Manual:LocalSettings.php MediaWiki LocalSettings.php Manual page]. | |||
The default value of the Subpage setting for each Namespace can be found on the [http://www.mediawiki.org/wiki/Manual:$wgNamespacesWithSubpages MediaWiki $wgNamespacesWithSubpages Manual page]. | |||
For the [[Main Page|PBTWiki]], the default values are modified somewhat. The relevant section from <code>LocalSettings.php</code> is shown below: | |||
<pre> | |||
## Enable subpages in all default namespaces | |||
$wgNamespacesWithSubpages = array( | |||
NS_MAIN => true, | |||
NS_TALK => true, | |||
NS_USER => true, | |||
NS_USER_TALK => true, | |||
NS_PROJECT => true, | |||
NS_PROJECT_TALK => true, | |||
NS_FILE => false, | |||
NS_FILE_TALK => false, | |||
NS_MEDIAWIKI => true, | |||
NS_MEDIAWIKI_TALK => true, | |||
NS_TEMPLATE => true, | |||
NS_TEMPLATE_TALK => true, | |||
NS_HELP => false, | |||
NS_HELP_TALK => false, | |||
NS_CATEGORY => true, | |||
NS_CATEGORY_TALK => true, | |||
NS_SPECIAL => false, | |||
NS_MEDIA => false | |||
); | |||
</pre> | |||
== Short URL == | == Short URL == | ||
Line 29: | Line 118: | ||
</pre> | </pre> | ||
In addition, the <code>$wgArticlePath</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: | ||
Line 39: | Line 128: | ||
$wgScriptPath = "/pbt/pbtWiki"; | $wgScriptPath = "/pbt/pbtWiki"; | ||
$wgArticlePath = "/pbt/wiki/$1"; | $wgArticlePath = "/pbt/wiki/$1"; | ||
$wgUsePathInfo = true; | |||
$wgScriptExtension = ".php"; | $wgScriptExtension = ".php"; | ||
</pre> | </pre> |
Latest revision as of 15:57, 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 and Groups
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;
Taking the line $wgGroupPermissions['user']['edit'] = true;
as an example, each line consists of three parts: the name of the group ('user'
), the user permission to modify ('edit'
) and the Boolean value used to set the permission in question (true
).
So in this case, anybody in the 'user'
group is allowed to edit pages.
An asterisk, '*'
, in the user group means that the permission applies to all groups; so in the case of the code above, the line $wgGroupPermissions['*']['writeapi'] = false;
means that nobody can create APIs.
Subsequent permissions will override earlier ones, so the line $wgGroupPermissions['sysop']['createaccount'] = true;
means that anyone in the 'sysop'
group can create accounts, overriding the $wgGroupPermissions['*']['createaccount'] = false;
line.
For a list of all the default groups available, see the List of groups section on the MediaWiki User Rights Manual page.
For a list of all the permissions that can be modified and their default settings, see the List of permissions section on the MediaWiki User Rights Manual page.
Changing the group that each user is a member of is carried out through the Special:User Rights page.
To list all users, see the Special:User List page.
Subpages and Namespaces
Subpages introduce some hierarchical organization into wiki pages, with levels of the hierarchy separated by slashes (/
).
More information on Subpages is available on the MediaWiki Subpages Help page.
Enabling subpages involves modifying the settings in LocalSettings.php
that correspond to the associated Namespace.
A Namespace is a collection of pages which have content with a similar purpose, i.e. pages where the intended use is the same.
More information on Namespaces can be found on the MediaWiki Namespace Manual page.
A number of default Namespaces are available: the full list can be found in the Built-in Namespaces section of the MediaWiki Namespace Manual page.
It is possible to add custom Namespaces: however, only the default ones are used for the PBTWiki.
Subpages are enabled for specific Namespaces by setting the $wgNamespacesWithSubpages
array in the LocalSettings.php
file: for more information see the Enabling Subpages section of the MediaWiki LocalSettings.php Manual page.
The default value of the Subpage setting for each Namespace can be found on the MediaWiki $wgNamespacesWithSubpages Manual page.
For the PBTWiki, the default values are modified somewhat. The relevant section from LocalSettings.php
is shown below:
## Enable subpages in all default namespaces $wgNamespacesWithSubpages = array( NS_MAIN => true, NS_TALK => true, NS_USER => true, NS_USER_TALK => true, NS_PROJECT => true, NS_PROJECT_TALK => true, NS_FILE => false, NS_FILE_TALK => false, NS_MEDIAWIKI => true, NS_MEDIAWIKI_TALK => true, NS_TEMPLATE => true, NS_TEMPLATE_TALK => true, NS_HELP => false, NS_HELP_TALK => false, NS_CATEGORY => true, NS_CATEGORY_TALK => true, NS_SPECIAL => false, NS_MEDIA => false );
Short URL
The default page address for a MediaWiki installation looks something like this:
However, what we would prefer is something like this:
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