Editor campaigns/Persistence and domain layer notes

Goals

 * Isolate all direct database access and code dependent on the database implementation.
 * Keep persistence logic separate from higher-level coordinating functions (logging, saving or restoring page revisions, checking user rights) and presentation logic (i18n messages, html construction, request details).
 * Expose an intuitive, opaque persistence PHP API to other layers of the system.
 * Keep open the possibility of switching out the DB implementation for a structured data store at a later date.
 * Optimize DB use:
 * Let the API consumer request only the fields needed, as per these guidelines.
 * Use unique indexes and appropriate SQL techniques to avoid locking reads.
 * Write tests as we go and aim for full code coverage.
 * Support the growth of the domain in a modular way for diverse use cases (edit-a-thons, courses, projects).

Adding general stuff that could go in core

 * Keep general additions compact.