Extension:MediaWikiLite

The idea of MediaWikiLite is to allow the current MediaWiki codebase to run as a standalone server without requiring a database server or web-server. This forms the foundation for a number of alternative uses for the MediaWiki software in enviroments where the current LAMP architecture is too resource intensive.
 * Personal wiki: Personal desktop wiki's are becoming very popular, but they do not use the MediaWiki parser, and making a fork of the parser code defeats the purpose.
 * Embedded devices such as PDA's, iPod's and iPhone's can only run lite applications effectively and getting MediaWiki onto them would be very useful, especially if it's designed to synchronise with a web-based mirror when an internet connection is available.
 * PeerPedia: A lite version of MediaWiki is required to make it a possible candidate for a client side wiki interface to a P2P article space.

This extension creates a new database subclass which allows a MediaWiki to work from an SQLite database instead of MySQL. MySQL is good for large centralised sites serving many clients, but we'd like MediaWiki to be able to run on small local systems such as iPods or iPhones. MySQL is the main obstacle preventing us from creating a light-weight MediaWiki install which would also be a big step towards our PeerPedia idea.

Current State
This extension in still in beta state and is being tested at www.mediawikilite.org.

Installation
This extension is in the form of two PHP scripts, MediaWikiLite.php and DatabaseSqlite.php. Create a directory called MediaWikiLite in your extensions directory and save both of the scripts into it. Also the SQLite library must be installed for PHP and the MediaWiki installer script needs to be modified.

SQLite Installation
It's important to have this working with SQLite3 rather than 2 because version 3 supports more similar syntax for some SQL such as table creation than version 2. Aside from that, version 3 uses more compact files and executes more efficiently. SQLite3 works via PHP's PDO functions.

On Debian-like systems, use the following to install the PHP library and optionally the shell interface to the database as well. apt-get install php5-sqlite3 apt-get install sqlite3

Installer modification
The MediaWiki installer script (wiki/config/index.php) needs to be modified to add SQLite to the list of database types available to choose from for the installation. There is a pre-modified version at MWLite/config.php which is based on MediaWiki 1.11's install script, or if you're running a different version of MediaWiki or you'd prefer to make the modifications yourself, instructions follow.

First, add the following to the end of the $ourdb array: Further down in the config/index.php installer script there is more database specific code for creating an initial MediaWiki database. In the case of MySQL it reads in tables.sql and interwiki.sql from the maintenance dir using the dbsource global function, but if it's PostgreSQL it executes the DatabasePostgresql::setup_database method, and if it's neither it raises an error saying it doesn't know how to handle the database type. I adjusted that code (around line 1000) to make it execute setup_database for all database types that are not MySQL as follows: