Manual:Running MediaWiki on Sourceforge.net

From MediaWiki.org

Jump to: navigation, search

Contents

[edit] Introduction

Let's say that :

  • your project is named "myproject"
  • your login on sourceforge is "username"
  • You want to install mediawiki-1.13.1 on your sourceforge web site.

[edit] Installation

[edit] Database creation

Log in on sourceforge, go to "Admin/shell/DB/Web", click on "Manage Project Databases" and create the users (readonly, readwrite and admin)

For example :

  • m12345ro:passworddb
  • m12345rw:passworddb
  • m12345admin:passworddb

Create the database m12345_wikidb on https://mysql-m.sourceforge.net/ (https://mysql-[your project character].sourceforge.net/)

[edit] Copy mediawiki on your site

Copy content of mediawiki-1.13.1 to sftp://username,myproject@web.sourceforge.net/home/groups/m/my/myproject/htdocs/wiki

Do not copy the images folder.

[edit] Create a symbolic link for sessions

PHP sessions needs special cares on SF.net servers as SF.net hosts a server farm and not a single server. If you use command line on linux, this means :

#sftp username,myproject@web.sourceforge.net:/home/groups/m/my/myproject/htdocs/wiki
#mkdir /home/groups/m/my/myproject/persistent/sessions
#symlink /home/groups/m/my/myproject/persistent/sessions /home/groups/m/my/myproject/htdocs/wiki/sessions

Change the rights of /home/groups/m/my/myproject/persistent/sessions (a+rwx)

[edit] Create a symbolic link for images

To enable image uploads, the first step is to ensure that the images directory is writable. As with the sessions directory, this is done by creating a writeable directory in the /home/groups/m/my/myproject/persistent directory and create a symbolic link to this directory :

#sftp username,myproject@web.sourceforge.net:/home/groups/m/my/myproject/htdocs/wiki
#mkdir /home/groups/m/my/myproject/persistent/images
#symlink /home/groups/m/my/myproject/persistent/images /home/groups/m/my/myproject/htdocs/wiki/images

Copy the content of mediawiki-1.13.1/images to /home/groups/m/my/myproject/htdocs/wiki/images

Change the rights of /home/groups/m/my/myproject/htdocs/wiki/images (a+rwx)

[edit] Modify index.php

Edit /home/groups/m/my/myproject/htdocs/wiki/config/index.php and comment :

/*
if( !is_writable( "." ) ) {
	dieout( "<h2>Can't write config file, aborting</h2>

	<p>In order to configure the wiki you have to make the <tt>config</tt> subdirectory
	writable by the web server. Once configuration is done you'll move the created
	<tt>LocalSettings.php</tt> to the parent directory, and for added safety you can
	then remove the <tt>config</tt> subdirectory entirely.</p>

	<p>To make the directory writable on a Unix/Linux system:</p>

	<pre>
	cd <i>/path/to/wiki</i>
	chmod a+w config
	

Afterwards retry to start the <a href=\"\">setup</a>.
" );

}

*/

[edit] Configure mediawiki

Go to http://myproject.sourceforge.net/wiki/

   * Wiki name:MyProject
   * Contact e-mail: username@users.sourceforge.net
   * Admin username : WikiSysop
   * Password : mypassword
   * Shared memory caching: CACHE_ACCEL
   * E-mail (general): disabled
   * mysql: mysql-m
   * Database name: m12345_wikidb
   * DB username : m12345admin
   * DB password: passworddb 

The result configuration will be displayed. Copy it to sftp://username,myproject@web.sourceforge.net/home/groups/m/my/myproject/htdocs/wiki/LocalSettings.php

Remove config folder

[edit] Memory

Start LocalSettings.php with

<?php
# If PHP's memory limit is very low, some operations may fail.
ini_set( 'memory_limit', '32M' );

SourceForge requires that you ask their permission before you use this setting [1]

[edit] Sessions

Add after ini_set in LocalSettings.php :

session_save_path("/home/groups/m/my/myproject/htdocs/wiki/sessions/");

[edit] Disable site css and js

# site css and site js make loading very slow
$wgUseSiteCss=false;
$wgUseSiteJs=false;

[edit] Optional configuration

[edit]

Modify in wiki/includes/Skin.php :

	function getPoweredBy() {
	        global $wgStylePath;
	        $url = htmlspecialchars( "$wgStylePath/common/images/poweredby_mediawiki_88x31.png" );
        	$sf  = '<a href="http://sourceforge.net"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=208808&type=1" width="88" height="31" border="0" alt="SourceForge.net Logo" /></a>';
        	$img = '<a href="http://www.mediawiki.org/"><img src="'.$url.'" alt="MediaWiki" /></a>'.$sf;
        	return $img;
	}

[edit] Enabling upload

You then need to change a setting in LocalSettings.php to enable upload :

$wgEnableUploads = true; 

[edit] (Anonymous) users are 127.0.0.1

Users may be all linked to the IP address 127.0.0.1, which makes difficult to block vandals. Use the $wgSquidServers variable to display the real IP address by adding the following line in LocalSettings.php:

$wgSquidServers = array('127.0.0.1');