User:Kaldari/Task 1

Set-up
For this task, you'll need a local copy of the MediaWiki database. You can download this SQL dump of the Northern Sotho Wikipedia (10 MB) and import it into a local MySQL instance, or you can install MediaWiki and populate it with your own data (or do both).

Task
Write a PHP program that takes the following as query string parameters: Using these 4 parameters, your program should answer the question "In the category X, what were the X most-edited articles between the days X and X, and how many times were each of them edited during that period." Don't worry about subcategories. The results should be output as JSON, along with the total time that the query or queries took to run.
 * The name of a MediaWiki category (for example 'Afrika_Borwa' if you're using the Northern Sotho Wikipedia data)
 * The number of articles to list
 * A start date in ISO 8601 format (for example '2011-07-31')
 * An end date in ISO 8601 format (for example '2013-10-17')

Hints: The revision table stores all the edits. The categorylinks table stores category membership. The page table stores the titles of articles. MediaWiki stores timestamps in the format yyyymmddhhmmss.

The code should be a stand-alone PHP program that accesses the MediaWiki database directly, not a MediaWiki extension or maintenance script.

Code checked into GitHub is ideal.