GeneWiki:Sync

is kept up-to-date through a program we developed at the Scripps Research Institute called MediaWiki Sync. This guide describes how to set up MediaWiki Sync for your own project. =Introduction=

What is MediaWiki Sync?
MediaWiki Sync provides the ability to keep a selection of pages from one MediaWiki site (the "source") mirrored on another MediaWiki site (the "target"). We currently use it to keep all the human gene pages on Wikipedia as well as all the SNP pages from SNPedia up to date on. When an editor at either of the source sites makes an edit to a tracked page, MediaWiki Sync copies the newly-edited page to the target. If desired, Sync can also edit the pages before they're copied to the target. For instance, we currently convert all links to semantic links, add a couple of templates, and add annotations from the NCBO Annotator service.

Requirements
= Usage =
 * The target and source MediaWiki installations must have their API accessible
 * An account on the source that can build a watchlist containing the pages to track (we've included a utility to automate adding classes of pages to the watchlist given a set of criteria)
 * An account on the target that can create and edit pages
 * A copy of the Java Runtime Environment (JRE)

Downloads

 * Source code (Eclipse project):
 * Pre-built .jar with dependencies included:

Installation
Users have the option of using a pre-built .jar file or building it from source. We recommend building it from source so that users can add their own on-the-fly edit behavior (described below). Before beginning installation, the user should edit the SyncService.conf.example to specify the source and target MediaWiki sites, as well as any other pertinent information. They should save this edited copy as SyncService.conf.

Building from source
Requirements: Building from source is recommended if the user wants to add any additional behaviors to MediaWiki Sync, such as on-the-fly edits. The source is distributed as an Eclipse project and the most current version is available in the Mercurial repositories here. The project also uses Maven for dependency management.
 * Eclipse
 * Maven Integration for Eclipse plugin
 * Mercurial (hg) distributed version control

Hacking the source
MediaWiki Sync was intended to be customized according to specific needs. To add custom behavior, simply extend the Sync.java class and implement the rewriteArticleContent method with your code, then point the SyncScheduler.java class's start method to point to your implementation. For example, here is a simple Sync implementation that adds a template to the top of each page: The SyncScheduler class is then modified on line 203 from to

When MediaWiki Sync is launched, each copied page will have the prepended to it. For examples of some more complicated rewrite rules, the ones we use to maintain are available in the GeneWikiPlus branch of the repository under the Rewrite.java class

Compiling
We export the project as a runnable .jar file from Eclipse, enclosing all dependencies into one file for easy deployment on a remote server. On Eclipse, go to File -> Export..., chose Runnable Jar, and make sure you specify SyncScheduler as the main entry point.