Installation

From Fancyclopedia 3
Jump to navigation Jump to search

Set up Dreamhost domains and databases[edit]

Login to Dreamhost, visit Domains/Manage Domains/Add Hosting to Domain/Subdomain

add new subdomain of fancyclopedia.org called wiki.fancyclopedia.org Select remove WWW Use user fancyclopedia Directory /home/fancyclopedia/wiki.fancyclopedia.org Default other options

Wait a few hours for DNS propagation, until dns lookup works

Visit More/MySQL databases, add new hostname mysql (under dropdown wiki.fancyclopedia.org, create database fancyclopedia, using hostname mysql.wiki.fancyclopedia.org (mysql.wiki.fancy-test.com), first user fancyclopedia password ******

(View database from https://west1-phpmyadmin.dreamhost.com/?hostname=mysql.wiki.fancy-test.com)

Install wiki[edit]

Visit https://www.mediawiki.org/wiki/Download and download latest version

Wait a few hours for DNS propagation, until dns lookup works

login as fancyclopedia@elgin.dreamhost.com

rm -rf wiki.fancyclopedia.org
tar xzf mediawiki-1.33.1.tar.gz
mv mediawiki-1.33.1 wiki.fancyclopedia.org
cd wiki.fancyclopedia.org
vi robots.txt
User-agent: *
Disallow:

Visit https://wiki.fancyclopedia.org/ and click on 'set up wiki'. English language, Continue

database type: Mysql
database host: mysql.wiki.fancy-test.com
database name: fancyclopedia
table prefix: <none>
user name: fancyclopedia
password: ********

Continue

Storage engine: InnoDB

Continue

Name of wiki: Fancyclopedia 3
Project Namespace: same
user: mlo
password: <any 10 chars>
Email: mlo@baskerville.org
Share: No
I'm bored

Continue Continue Continue Save LocalSettings.php, scp it to dreamhost in ~fancyclopedia/wiki.fancyclopedia.org/LocalSettings.php


vi LocalSettings.php

add after php line

# JRB debugging
# error_reporting( -1 );
# ini_set( 'display_errors', 1 );

After line $wgScriptPath = ""; add

# JRB URL shortening advice from https://shorturls.redwerks.org
$wgScriptExtension = ".php";
$wgArticlePath = "/$1";
$wgUsePathInfo = true;

Change Logo, using a logo designed according to https://www.mediawiki.org/wiki/Manual:$wgLogo, and placed in ~/fancyclopedia.org

$wgLogo = "$wgResourceBasePath/fancyclopedia_logo.jpg";

add after 'Add more configuration options below.'


####################################################################

# Require that a user be registered before they can edit.
$wgGroupPermissions['*']['edit'] = false;

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

# allow users to define their own css and js
$wgAllowUserCss  = true;
$wgAllowUserJs  = true;

# Allow image uploads
$wgEnableUploads = false;

# Allow external images
$wgAllowExternalImages = true;

wfLoadExtension( 'WikiCategoryTagCloud' );

require_once "$IP/extensions/DynamicPageList/DynamicPageList.php";

wfLoadExtension( 'CategoryTagSorter' );

wfLoadExtension( 'ParserFunctions' );

wfLoadExtension( 'Iframe' );
$wgIframe['server']['fanac'] = [ 'scheme' => 'http', 'domain' => 'fanac.org' ];
$wgIframe['server']['files'] = [ 'scheme' => 'http', 'domain' => 'files.fancyclopedia.org' ];
$wgIframe['server']['local'] = [ 'scheme' => 'http', 'domain' => 'files.fancyclopedia.org' ];
$wgIframe['delay'] = -1;

# WYSISYG editor
#Default user options:
$wgDefaultUserOptions['riched_disable']               = false;
$wgDefaultUserOptions['riched_start_disabled']        = false;
$wgDefaultUserOptions['riched_use_toggle']            = true;
$wgDefaultUserOptions['riched_use_popup']             = false;
$wgDefaultUserOptions['riched_toggle_remember_state'] = true;
$wgDefaultUserOptions['riched_link_paste_text']       = true;

//MW>=1.25 and versions of WYSIWYG >= "1.5.6_0 [B551+02.07.2016]" has dependency
//to module of WikiEditor so it must be enabled too (or otherwise file
//extension.json has to be edited manually to remove dependency)
wfLoadExtension( 'WikiEditor' );

require_once "$IP/extensions/SimpleTable/SimpleTable.php";

# Allow any display title for {{DISPLAYTITLE:new title}}
$wgRestrictDisplayTitle = false;

# Citation footnotes
wfLoadExtension( 'Cite' );

# Fix double redirects after page move
$wgFixDoubleRedirects = true;

# List unused redirects
wfLoadExtension( 'UnusedRedirects' );

# Interwiki table editing
require_once "$IP/extensions/Interwiki/Interwiki.php";
$wgGroupPermissions['sysop']['interwiki'] = true;

wfLoadExtension( 'DisplayTitle' );

# Allow for string parser functions
$wgPFEnableStringFunctions = true;

# Allow CategoryFunctions - locks up site so disable
#require_once "$IP/extensions/CategoryFunctions/CategoryFunctions.php";

wfLoadExtension( 'PageInCat' );

# 404 page handler
#require_once "$IP/extensions/Special404/Special404.php";

# Missed pages stats
wfLoadExtension( 'MissedPages' );

#Interactive Timelines
wfLoadExtension("InteractiveTimeline");

#Allow external images using <img html tag
$wgAllowImageTag = true;

# Debugging

#$wgShowSQLErrors = true;
#$wgShowDBErrorBacktrace = true;
#$wgDebugDumpSql = true;
#$wgShowExceptionDetails=true;
#$wgDebugToolbar=true;
#$wgShowDebug =true;
#$wgDevelopmentWarnings=true;

# Allow regular expression functions
require_once "$IP/extensions/RegexFunctions/RegexFunctions.php";

# Allow tests whether a page is in a category
require_once "$IP/extensions/CategoryTests/CategoryTests.php";

#Search and Replace for admins only
wfLoadExtension( 'ReplaceText' );

Extensions[edit]

cd extensions
tar xzf CategoryTagSorter-REL1_33-6a74e5c.tar.gz  
tar xzf DisplayTitle-REL1_33-0705659.tar.gz
tar xzf DynamicPageList-REL1_33-c92f6b9.tar.gz
tar xzf MissedPages-REL1_33-85a2868.tar.gz
tar xzf PageInCat-REL1_33-978c744.tar.gz
tar xzf TimelineTable-REL1_33-afbeff4.tar.gz
tar xzf UnusedRedirects-REL1_33-58b6abf.tar.gz
tar xzf WikiCategoryTagCloud-REL1_33-6460123.tar.gz
tar xzf RegexFunctions-REL1_34-4c21ab2.tar.gz
tar xzf CategoryTests-REL1_34-f568f59.tar.gz
svn co https://github.com/sigbertklinke/Iframe.git/trunk Iframe
mkdir SimpleTable
vi SimpleTable/SimpleTable.php and add content from
https://www.mediawiki.org/wiki/Extension:SimpleTable/1.2a
vi SimpleTable/SimpleTable.php
add to private $separators
'barbar' => '/\|\|`/',
Change public function hooktab to have
$sep = 'barbar';
Change params setup to

       $params = 'data-expandtext="+" data-collapsetext="-"';
       $collapse = ;
       foreach ($argv as $key => $val) {
           if ($key == 'sep')
               $sep = $val;
           else if ($key == 'head')
               $head = $val;
           else if ($key == 'applycssborderstyle')
               $applycssborderstyle = $val;
           else if ($key == 'collapse')
               $collapse= 'mw-collapsed';
           else
               $params .= ' ' . $key . '="' . $val . '"';
       }
       $params .= ' ' . 'class="wikitable mw-collapsible ' . $collapse . '"';


#Give up on 404 handler, MissedPages more useful
#vi Special404/i18n/en.json
and change 

"special404-body": "The URL you requested was not found. Perhaps because you are using a Wikidot URL that is not valid with mediawiki. Try replacing - with spaces, and putting capitals on second and subsequent words. More advice on the main page"

vi DisplayTitle/includes/DisplayTitleHooks.php
and edit private static function getDisplayTitle to have
               if ( !is_null( $redirectTarget ) ) {
                       $redirect = true;
                       /* JRB we don't want this for redirects
                       $title = $redirectTarget;
                       */
Fix MissedPages extension with this
cd extensions
git clone https://github.com/TheWatcher/InteractiveTimeline.git
cd InteractiveTimeline
git checkout REL1_32

Seed wiki[edit]

Make a backup of the fancyclopedia 0 wiki

mysqldump --ignore-table=mysql.event --skip-lock-tables --quote-names -ufancytestwiki0 -p -hmysql.wiki0.fancy-test.com fancytestwiki0a > fancytestwiki0.dump

Import it into wiki

mysql -p -ufancyclopedia -hmysql.wiki.fancy-test.com fancyclopedia < fancytestwiki0.dump

.htaccess[edit]

vi .htaccess
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/index.php [L]

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^/?images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/thumb.php?f=$1&width=$2 [L,QSA,B]

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^/?images/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/thumb.php?f=$1&width=$2&archived=1 [L,QSA,B]

#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^/?.*$ /index.php?title=Special:Error404