MediaWiki: Difference between revisions

From WickyWiki
Line 154: Line 154:
<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
...
...
upload_max_filesize = 10M
upload_max_filesize = 5M
...
...
post_max_size = 10M
post_max_size = 5M
...
...
max_execution_time = 600 ; 10min
max_execution_time = 180 ; 3min
...
...
max_input_time = 600 ; 10min
max_input_time = 180 ; 3min
</syntaxhighlight>
</syntaxhighlight>
</blockquote>
</blockquote>

Revision as of 11:56, 7 July 2013


Installation and configuration

MySQL database server and PHP

For more info: MySQL

sudo apt-get install install apache2 mysql-server php5 php5-mysql

MediaWiki website files

Download the code and copy to /var/www/mediawiki

Edit LocalSettings.php to add extensions and to customize.

Configuration LocalSettings.php

sudo gedit /var/www/mediawiki/LocalSettings.php

# Image uploads, make sure the 'images' directory is writable
$wgEnableUploads  = true;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";

# Skin
$wgDefaultSkin = "vector";
$wgFavicon = "$wgScriptPath/images/favicon.ico";

# Extensions/Vector for Vector skin
require_once("$IP/extensions/Vector/Vector.php");
$wgVectorFeatures['collapsiblenav']['global'] = false;
$wgVectorFeatures['expandablesearch']['global'] = false;
$wgVectorFeatures['sectioneditlinks']['global'] = false;
$wgVectorFeatures['footercleanup']['global'] = true;
$wgVectorUseSimpleSearch = true;

# Extensions/SyntaxHighlight_GeSHi
require_once("$IP/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php");

# Extensions/WikiEditor
require_once("$IP/extensions/WikiEditor/WikiEditor.php");
$wgDefaultUserOptions['usebetatoolbar'] = 1;
$wgDefaultUserOptions['usebetatoolbar-cgd'] = 1;
# Displays the Preview and Changes tabs
$wgDefaultUserOptions['wikieditor-preview'] = 1;
# Displays the Publish and Cancel buttons on the top right side
$wgDefaultUserOptions['wikieditor-publish'] = 1;

# Reading by anonymous users
$wgGroupPermissions['*']['read'] = true;

# Always allow reading access to the login page
$wgWhitelistRead = array ("Special:Userlogin", "MediaWiki:Common.css", "MediaWiki:Common.js"
	, "MediaWiki:Monobook.css", "MediaWiki:Monobook.js", "-");

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

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

Apache2 webserver configuration

sudo gedit /etc/apache2/sites-available/http_wilbertvolkers.dyndns.org
<VirtualHost *:80>
	Servername mediawiki.wilbertvolkers.dyndns.org
	
	#redirect UserLogin page to https
	# you will need to configure your https as well
	RewriteEngine On
	RewriteCond %{REQUEST_URI} ^/mediawiki/index.php$
	RewriteCond %{QUERY_STRING} ^title=Special:UserLogin
	RewriteCond %{REQUEST_METHOD} ^GET$
	RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1 [R]

	DocumentRoot /var/www/
	Alias /mediawiki/ /var/www/mediawiki/
	<Directory /var/www/mediawiki/>
		AllowOverride None
		Order allow,deny
		allow from all
	</Directory>

	ErrorLog ${APACHE_LOG_DIR}/error.log
	LogLevel warn
	CustomLog ${APACHE_LOG_DIR}/access.log combined

	ServerSignature Off
</VirtualHost>

If you login using http your password will be send over the net in 'clear text'. To force login via https the RewriteRule is added, however, you will also need to configure the SSL part of your website. Read Create certificates for Apache2.

The mediawiki - part in the configuration file will look something like this:

sudo gedit /etc/apache2/sites-available/https_wilbertvolkers.dyndns.org
...

<VirtualHost *:443>
	...

	# mediawiki directory https
	Alias /mediawiki/ /var/www/mediawiki/
	<Directory /var/www/mediawiki/>
		SSLRequireSSL
		AllowOverride None
		Order deny,allow
		Allow from all
	</Directory>

	...

</VirtualHost>

PHP configuration

With wikimedia, when you import or export all pages or when you upload images and files, this will take more space and time that normally is allowed by PHP. Change theses settings:

locate php.ini
sudo gedit /..path../php.ini
	...
	upload_max_filesize = 5M
	...
	post_max_size = 5M
	...
	max_execution_time = 180 ; 3min
	...
	max_input_time = 180 ; 3min

Restart Apache2 to apply the settings:

service apache2 restart

Categories

Use categories to group your pages by including one or more Category tags:

 [[Category:Name]]

Try to distribute your pages evenly over categories, first look here if any of the available categories can be used:

Special:Categories

Tips

Keywords

You can make the search tool more efficient if you add synonyms and keywords to a page. You might want to keep these hidden from the reader to keep the text readable . Insert like this:

<!-- hidden text -->

Hotkeys

The tooltips will show you the letter of the shortcut between brackets. You need to press SHIFT+ALT+<letter> to use it.

Shortcuts:

  • SHIFT+ALT+Z main page
  • SHIFT+ALT+E start edit (if allowed)
    • you can also right click on the section or click the [edit] link
  • SHIFT+ALT+P preview
  • SHIFT+ALT+S save
  • SHIFT+ALT+C cancel

Modify the [edit] link to be smaller with "myskin":

sudo gedit /var/www/mediawiki/skins/myskin/main.css
/* change edit-link size */
span.editsection {
	font-size: 30%;
	float: right;
	margin-left: 5px;
}

Special Import / Export pages

Import (as Admin)

Special:Import

Export pages

Special:Export

Export full contents

sudo php maintenance/dumpBackup.php --full --uploads > ../wiki_dump.xml

See also

Go to Apache2 webserver to read about installing and configuring Apache2 webserver.

Accidentally committed information that really needs to be removed? Go to: Permanently remove a MediaWiki revision using SQL.

MediaWiki help pages

Other sources