Extension:VirtualPage

<?php /*

Purpose
Provides regex based virtual page serving functionality based on a virtual directory.

Theory of Operation
When a user requests a non-existing page (i.e. not in the database) from namespace X, this extension looks up the virtual directory page 'X:Virtual Directory', parses it and performs a regular expression match to find a 'target template' for the requested page. If a template can not be found, the transaction reverts to the standard MediaWiki one.

Features

 * No patches
 * Fast - stub functionality for usual queries
 * Virtual Directory page can be in wikitext format

Basics
Create a page titled 'Virtual Directory' for each namespace where this extension should execute.

Format of the Virtual Directory
The 'link' corresponds to the page 'template' which will be served upon a successful regex match.
 * One 'regex' expression per '\n' (i.e. newline) terminated line.
 * Each line must contain 1 regex pattern + 1 link
 * Regex pattern format: /..regex expression here../
 * Link format: namespace:page

Example

 * Create a page called 'Virtual Directory' in the main namespace and place the following:
 * All the non-existing pages following 'Pattern1' will get served using 'Log:LogTemplate'
 * All the non-existing pages following 'Pattern2' will get served using 'Blog:BlogTemplate'

Dependancy

 * StubManager extension

Installation
To install independantly from BizzWiki:
 * Download 'StubManager' extension
 * Download the two files of this extension (VirtualPageSwitch.php & VirtualPage.php)
 * Apply the following changes to 'LocalSettings.php'
 * Make sure to have 'VirtualPage.php' and 'VirtualPageSwitch.php' in the same directory.