Manual talk:Wiki family/Drupal-style LocalSettings.php

From MediaWiki.org
Jump to navigation Jump to search

At least one person has had problems with this code (see the Wiki family talk page). My own experience was that the Drupal-style multi-site wiki did not work for other reasons (which I have now corrected in the Manual). Once these had been debugged, the Drupal algorithm worked fine. In the process of my own debugging, I created a greatly simplified LocalSettings.php based on $IP/WebStart.php to go in the mediawiki/code directory. It works only for sites where the host name and sites/sitename directory are the same.

<?php 
/**
 * Very simple configuration to cope with my local sites. Assumes the wiki URL
 * is of the form http://wikiname 
 */

$confdir = '/home/web/mediawiki/sites';
 
$dir = $_SERVER['HTTP_HOST'];

if (!file_exists("$confdir/$dir/LocalSettings.php")) {
    require_once( "$IP/includes/DefaultSettings.php" ); # used for printing the version
    require_once( "$IP/includes/templates/NoLocalSettings.php" );
    die();
}
require_once( "$confdir/$dir/LocalSettings.php" );

?>

Giles65 20:40, 23 April 2010 (UTC)