Extension:DataModel

Installation
To install this extension, add the following to LocalSettings.php:

This extension depends on an addition to MediaWiki core, ("Added merge function to BagOStuff for CAS-like functionality"), which will be part of MediaWiki version 1.21.

DataModel
DataModel.php can be easily extended (as sample/DataModelSample.php does) for a specific implementation. Basically, these methods can then be used to get/manipulate the data:

Public methods






->insert: Will insert the data of a newly created object (e.g. DataModelSample) into the DB (and temporarily cache)

->update: Will update altered data of an existing object in the DB (and cache)

->delete: Will delete DB & cache data

Static vars
static $table, $idColumn, $shardColumn: These static vars should be set in the extending class (e.g. sample/DataModelSample.php) for the DataModel code to know which value the key should be sharded over (or not - sharding is assumed), which table to write the data to and which unique id to save for the lists.

static $lists, $sorts (I promised to get back to this): Performing a selection query (e.g. "... WHERE visible = 1 ORDER BY title DESC") is quite a PITA when the data is possibly spread over multiple sharded DB's. Instead, a specific DataModel implementation (e.g. DataModelSample, which extends DataModel) should define "public static $lists = array(

Feedback
Open tickets in Wikimedia's Bugzilla under the "DataModel" component in the "MediaWiki extensions" product.
 * Open DataModel tickets