User Tools

Site Tools


MediaWiki info

Simple private wiki

For the common use case of “a private wiki, for oneself and approved others”, you need to:

  • Consider whether MediaWiki is right for you. MediaWiki was not originally designed for private wikis, so other software may be more suitable.
  • Restrict viewing
  • Restrict editing
  • Restrict account creation

MediaWiki version: 1.5 and after

# Disable reading by anonymous users
$wgGroupPermissions['*']['read'] = false;

# But allow them to access the login page or else there will be no way to log in!
# NOTE: You also need to provide access here to the .css and .js files that the
# allowed pages attempt to load; otherwise, users will get errors on the page
# when they attempt to load it (IE will complain about the errors;
# FF will show them in its error console)
# [You also might want to add access to "Main Page", "Wikipedia:Help", etc.)
$wgWhitelistRead = array ("Main Page", "Special:Userlogin", "MediaWiki:Common.css", "MediaWiki:Common.js", "MediaWiki:Monobook.css", "MediaWiki:Monobook.js", "-");

# Disable anonymous editing
$wgGroupPermissions['*']['edit'] = false;

# Prevent new user registrations except by sysops
$wgGroupPermissions['*']['createaccount'] = false;

How do I add extra namespaces?

To add a namespace, modify your LocalSettings.php file, and add namespaces via $wgExtraNamespaces. You can add the following code to add some namespaces, and its corresponding discussion namespace:

$wgExtraNamespaces[100] = "styrelsen";
$wgExtraNamespaces[101] = "styrelsen_talk";
$wgExtraNamespaces[102] = "moten";
$wgExtraNamespaces[103] = "moten_talk";
$wgExtraNamespaces[104] = "medlemmar";
$wgExtraNamespaces[105] = "medlemmar_talk";
$wgExtraNamespaces[106] = "lankar";
$wgExtraNamespaces[107] = "lankar_talk";
$wgExtraNamespaces[108] = "foto";
$wgExtraNamespaces[109] = "foto_talk";


  $wgExtraNamespaces = array(100 => "styrelsen", 101 => "styrelsen_talk", 102 => "moten", 103 => "moten_talk", 104 => "medlemmar", 105 => "medlemmar_talk", 106 => "lankar", 107 => "lankar_talk", 108 => "foto", 109 => "foto_talk");

:!: Note: Be sure to add underscores instead of spaces, such as in Portal_talk. Otherwise, the namespace will not be declared properly!

How do I put a text message (sitenotice) on every page?

Put a text in the MediaWiki:Sitenotice page. It will be displayed on top of every article page.

How do I customize the logo in the top left corner? Can I?

The logo is a portlet block without a pBody section. It is identified by the p-logo id. The background image is specified by the $wgLogo variable, which is defined in DefaultSettings.php. This location is relative to the web server root and not the system root. Redefine this in LocalSettings.php to change the image. If set wrong there will be no image on the page; check your web server error log and adjust accordingly. However the size of the p-logo will need to be big enough for the logo if it is not to be clipped. This is set in the stylesheet (main.css in Monobook), under the p-logo style, the default setting is:

#p-logo {
	z-index: 3;
	position: absolute; /*needed to use z-index */
	top: 0;
	left: 0;
	height: 155px;
	width: 12em;
	overflow: visible;


links/programutveckling/mediawiki_info.txt · Last modified: 2020-11-06 10:37 by