User talk:Laurie/Install

From PGVWiki
< User talk:Laurie
Revision as of 04:28, 4 March 2008 by Laurie (talk | contribs) (CommonSettings.php)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Please make any comments or suggestions to this here, as this page is protected.

Base system

Web Host Settings

  • PHP Installed 5.2.1
  • MySQL Installed 5.0.45-community
  • Apache 1.3.37 (Unix)

Directory Structure

Running on domain name - wiki.phpgedview.net

So as to run multiple Wiki's using the following directory structure

Root Directory of Web Site
Index html & index.htm - Menu page for various language wikis
/             
Directory structure and files for Mediawiki installation
/w                    Base installation directory
All mediawiki files placed here with exception of:-
    index.php
    images (directory)
Various Language Wikis are setup with this structure using language code as directory name (xx)
/xx                    directory named according to language code 
/xx/images             Image files for wiki
/xx/index.php
All remaining files and directories are linked to w via symbolic links

Mediawiki

Version 1.11.1 installed in base directory of /w

Symbolic links created for all directories and files to /w from root

ln -s ../w/file.or.directory.name file.or.directory.name

Databases

Running one database for all wiki's. Prefix used for each language eg.

en_      prefix for English
da_      prrfix for Danish

Database Security

Included the following line in CommonSettings.php. As this file is outside the website it is more secure as passwords are not included in the file.

require_once("/fullpath/external_to_websites/wiki_password_file_name.php");

Changed the following lines in LocalSettings.php so that working with variables and not real usernames/passwords

$wgDBuser           = $db_user;
$wgDBpassword       = $db_password;

Created relevant directory and file that is being called

<?php
  $wgDBuser = "    ";   //Username goes in here
  $wgDBpassword = " ";  //Password for user goes in here
?>

LocalSetting.php

The majority of this file has been moved to CommonSettings.php to allow consitency across all wikis. Language code is different for each wiki and used as a variable in CommonSettings.php. File then calls CommonSettings.php for processing.

<?php
# Use This area for items that need to be configured for each language
$wgLanguageCode = "en";             // Language Code for Wiki 
$googleAnalytics = "UA-1339101-8";  // Code for Google Analytics

# All settings come from the CommonSettings.php File
include_once( "../w/CommonSettings.php" );
?>

CommonSettings.php

<?php
## Language Code saved as variable in case reset before being defined.
$wgLanguageCodeTemp = "";
$wgLanguageCodeTemp .= $wgLanguageCode;

# This file was automatically generated by the MediaWiki installer.
# If you make manual changes, please keep track in case you need to
# recreate them later
#
# See includes/DefaultSettings.php for all configurable settings
# and their default values, but don't forget to make changes in _this_
# file, not there.

# If you customize your file layout, set $IP to the directory that contains
# the other MediaWiki files. It will be used as a base to locate files.
if( defined( 'MW_INSTALL_PATH' ) ) {
$IP = MW_INSTALL_PATH;
} else {
$IP = dirname( __FILE__ );
}

$path = array( $IP, "$IP/includes", "$IP/languages");
set_include_path( implode( PATH_SEPARATOR, $path ) . PATH_SEPARATOR . get_include_path() );

require_once( "includes/DefaultSettings.php" );

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

if ( $wgCommandLineMode ) {
if ( isset( $_SERVER ) && array_key_exists( 'REQUEST_METHOD', $_SERVER ) ) {
die( "This script must be run from the command line\n" );
}
} elseif ( empty( $wgNoOutputBuffer ) ) {
## Compress output if the browser supports it
if( !ini_get( 'zlib.output_compression' ) ) @ob_start( 'ob_gzhandler' );
}

# Reintroduce LanguageCode from Variable
$wgLanguageCode = "";
$wgLanguageCode .= $wgLanguageCodeTemp;

# Buildup $IP based on language code
$IP = "/home/mydigita/public_html/pgvwiki-website/";
$IP .= $wgLanguageCode;

## The URL base path to the directory containing the wiki;
## defaults for all runtime URL paths are based off of this.
## Build script path from language code
$wgScriptPath = "/";
$wgScriptPath .= $wgLanguageCode;

$wgSitename = "PGVWiki";

# Build up images locations
$wgUploadPath = "$wgScriptPath/images";
$wgUploadDirectory = "$IP/images";

## For more information on customizing the URLs please see:
## http://www.mediawiki.org/wiki/Manual:Short_URL

$wgEnableEmail = true;
$wgEnableUserEmail = true;

$wgEmergencyContact = "pgvwiki@mydigitalhome.com.au";
$wgPasswordSender = "pgvwiki@mydigitalhome.com.au";

## For a detailed description of the following switches see
## http://meta.wikimedia.org/Enotif and http://meta.wikimedia.org/Eauthent
## There are many more options for fine tuning available see
## /includes/DefaultSettings.php
## UPO means: this is also a user preference option
$wgEnotifUserTalk = true; # UPO
$wgEnotifWatchlist = true; # UPO
$wgEmailAuthentication = true;

# Get passwords from outside of website for secutiry reasons
require_once("../../../external_to_websites/pgvwiki/pgvwiki_passwords.php");
$wgDBtype = "mysql";
$wgDBserver = "localhost";
$wgDBname = "mydigita_pgvwiki";
$wgDBuser = $db_user;
$wgDBpassword = $db_password;
$wgDBport = "5432";
## Build database prefix
$wgDBprefix = "";
$wgDBprefix .= $wgLanguageCode;
$wgDBprefix .= "_";

# Schemas for Postgres
$wgDBmwschema = "mediawiki";
$wgDBts2schema = "public";

# Experimental charset support for MySQL 4.1/5.0.
$wgDBmysql5 = false;

## Shared memory settings
$wgMainCacheType = CACHE_NONE;
$wgMemCachedServers = array();

## To enable image uploads, make sure the 'images' directory
## is writable, then set this to true:
$wgEnableUploads = true;
$wgUseImageResize = true;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";

## If you want to use image uploads under safe mode,
## create the directories images/archive, images/thumb and
## images/temp, and make them all writable. Then uncomment
## this, if it's not already uncommented:
# $wgHashedUploadDirectory = false;

## If you have the appropriate support software installed
## you can enable inline LaTeX equations:
$wgUseTeX = false;

$wgLocalInterwiki = $wgSitename;

$wgProxyKey = "08a24d4a13d2f543bbd7e70efa5a9cd24b1a9c50f5f43b95389d9fb8535c06d4";

## Default skin: you can change the default skin. Use the internal symbolic
## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook':
$wgDefaultSkin = 'monobook';

## For attaching licensing metadata to pages, and displaying an
## appropriate copyright notice / icon. GNU Free Documentation
## License and Creative Commons licenses are supported so far.
# $wgEnableCreativeCommonsRdf = true;
$wgRightsPage = ""; # Set to the title of a wiki page that describes your license/copyright
$wgRightsUrl = "";
$wgRightsText = "";
$wgRightsIcon = "";
# $wgRightsCode = ""; # Not yet used

$wgDiff3 = "/usr/bin/diff3";

# When you make changes to this configuration file, this will make
# sure that cached pages are cleared.
$configdate = gmdate( 'YmdHis', @filemtime( __FILE__ ) );
$wgCacheEpoch = max( $wgCacheEpoch, $configdate );

# This snippet prevents editing from anonymous users
$wgGroupPermissions['*']['edit'] = false;
$wgLogo = "/pgv_logo.png";


?>

Add ons

Spam Prevention

To add Spamblacklist downloaded files from here (use the "download" link for each file), it also includes a readme file with detailed instructions.


Once the files were downloaded I then edited SpamBlacklist_body making the following changes for compatability with 1.5.3. Lines with - removed. Lines with + added.

--- SpamBlacklist_body.php?rev=1.11     2005-10-17 17:25:14.000000000 -0400
+++ SpamBlacklist_body.php      2005-10-17 17:34:45.000000000 -0400
@@ -59,7 +59,7 @@
                        if ( !$recache ) {
                                $this->regex = $wgMemc->get( "spam_blacklist_regex" );
                        }
-                       if ( !$this->regex ) {
+                       if ( !$this->regex || $this->regex == 1 ) {
                                # Load lists
                                $lines = array();
                                wfDebug( "Constructing spam blacklist\n" );
@@ -132,12 +132,9 @@
        }

        function getArticleLines( $db, $article ) {
-               $dbr = wfGetDB( DB_READ );
-               $cur = $dbr->tableName( 'cur' );
-               $res = $dbr->query( "SELECT cur_text FROM $db.$cur WHERE cur_namespace=0 AND cur_title='$article'" );
-               $row = $dbr->fetchObject( $res );
+                $row = wfMsgForContent($article);
                if ( $row ) {
-                       return explode( "\n", $row->cur_text );
+                       return explode( "\n", $row );
                } else {
                        return array();
                }

Added Spamblacklist to bottom of CommonSettings.php


# Spam Blacklist
require_once( "$IP/extensions/SpamBlacklist/SpamBlacklist.php" );
$wgSpamBlacklistFiles = array(
        "$IP/extensions/SpamBlacklist/blacklist", // Wikimedia's list

//          database    title
        "DB: pgvwiki   en:Mediawiki:Spamblacklist",
);

The following line has also been added to stop the insertion of Spam hidden in html code

 $wgSpamRegex="/overflow:\s*auto/";

Virus Detection

ClamAV already installed on server. Following added to CommonSettings.php

# AntiVirus Settings
$wgAntivirus = "clamav" ;
$wgAntivirusRequired = true ;

This will work in line with file uploads. At this time only graphic files can be uploaded.