Extension:Wikia.php

From Organic Design wiki
Revision as of 10:46, 26 June 2007 by Nad (talk | contribs) (better have some process in there too)

<?php

  1. This is our included LocalSettings code common to all the wikis on the OD/Wikia familyTemplate:Php
Info.svg These are the MediaWiki extensions we're using and/or developing. Please refer to the information on the mediawiki.org wiki for installation and usage details. Extensions here which have no corresponding mediawiki article are either not ready for use or have been superseded. You can also browse our extension code in our local Subversion repository or our GitHub mirror.
  1. - Licenced under LGPL (http://www.gnu.org/copyleft/lesser.html)
  2. - Author: http://www.organicdesign.co.nz/nad
  3. - Started: 2007-06-20, see article history

$wgArticlePath = '/$1'; $wgScriptPath = '/wiki'; $wgUseDatabaseMessages = true;

  1. Objects are just like normal Templates but represent an associated external instance of some kind

$wgExtraNamespaces = array( 1000 => 'Object', 1001 => 'Object talk', 1002 => 'Process', 1003 => 'Process talk' );

  1. Include the LocalSettings file for the domain, or default to OD

$settings = '/var/www/settings'; $domains = '/var/www/domains'; $files = '/var/www/files'; $extensions = dirname(__FILE__); $domain = $_SERVER['SERVER_NAME']; if (!is_file("$domains/$domain")) $domain = 'www.organicdesign.co.nz'; include("$domains/$domain"); $wgLocalInterwiki = $wgSitename;

  1. Pass an array with regexp keys and article-title values to setup domain-based default pages

function domainRedirect($list) { $d = $_SERVER['SERVER_NAME']; $t = $_REQUEST['title']; if (empty($t)) $t = ereg_replace('^/',,$_SERVER['PATH_INFO']); if (empty($t) || $t == 'Main_Page') foreach ($list as $regexp => $title) if (ereg($regexp,$d)) header("Location: $wgServer/$title") && die; }

?>