Reading/Web

This page is for notes about rewriting the mobile site (e.g., http://en.m.wikipedia.org) in PHP. Patrick Reilly is leading the porting project.

Current implementation

 * Ruby!
 * http://github.com/hcatlin/wikimedia-mobile/

Rewrite rationale

 * Puts the code in our code repo rather than on github
 * Easier to review code in a language that most Wikimedia/MediaWiki developers are already using (PHP, instead of Ruby)
 * Easier on the ops team to maintain servers (most infrastructure is already built for PHP web apps, not Ruby web apps)
 * Allows for third parties to easily create mobile sites

Rewrite specifications

 * Written in PHP
 * Extensible for any MediaWiki installation
 * Support current Ruby-implemented API (mentioned on bug; where is this?)

Future implementation

 * Extension MobileFrontend
 * A "mobile" skin

Implement views
Create the views needed to support XHTML, WML rendering of file, home, image and show

Implement layouts
Create the layouts needed to support XHTML, WML rendering of application

Implement parsers
Create the image, WML and XHTML parsers for various content

Create models
Create models for (article, device, image, [other resource])

Create controllers
Create articles controller or equivalent [if not MVC] (including helpers, etc.)

Create caching support
Implement server resource retrieval and caching support

Possible solution: http://www.mediawiki.org/wiki/Manual:Varnish_caching

Implement format lists
Implement formats list (view format e.g., html, etc., javascript support, layout)

Implement translation support
Convert translation support for various global strings. Use standard MediaWiki internationalization method.

Implement exception handling
Create global exception handling support

Implement basic logging
Implement basic logging and statistics support

Implement css
Create device and format based css (e.g., iphone, nokia, firefox, blackberry, etc.)

Possible Roadmap
A General Primer

With all of the different formats we have to support, there is a fairly simple system for correlating a Device with a Format with some specific actions to take based on that Format.

Process:
 * A request comes in from a mobile browser
 * The request generates a Device object
 * - Any method_missing that Device receives is looked up in the format specification


 * - The formats are specified in config/formats


 * An Article is fetched for that device
 * - First, the article figures out what kind of parser needed to be run on the page


 * - It then generates a key with that parser type.


 * - It then checks to see if that has been cached


 * - If it is not cached, it grabs scrapes the Wikipedia page and processes it with some parsers/* class


 * - If it is cached, it returns that cached object


 * The layout is generated with the returned Article#html
 * - The device format is used heavily here (aka, "= current_device.stylesheet_name")


 * - An "app/views/layouts/_search_#{format}.html" file is rendered in the search area


 * - Changes in the search box and CSS fields are the most different between formats