Extension:Memento

What can this extension do?
The idea of the Memento extension is to make it as straightforward to access articles of the past as it is to access their current version.

The Memento framework allows you to see versions of articles as they existed at some date in the past. All you need to do is enter a URL of an article in your browser and specify the desired date in a browser plug-in. This way you can browse the Web of the past. What the Memento extension will present to you is a version of the article as it existed on or very close to the selected date. Obviously, this will only work if previous (archived) versions are available on the Web. Fortunately, MediaWiki is a Content Management System which implies that it maintains all revisions made to an article. This extension leverages this archiving functionality and provides native Memento support for MediaWiki.

Use Cases

 * Users often wish to see versions of resources both before and after certain events, for example, the page about Michael Jackson both before and after his death, or follow the evolution of the description of the TSA's approach to air travel security since 2001.
 * Additionally, editors can benefit from Memento access to see where the hot spots of activity are, and the differences before and after editing wars.
 * By exposing Memento TimeGates and giving HTTP access to versions, MediaWiki allows for easy access to software agents to perform time series analysis of its resources, either by extracting information from the article (text mining, data extraction, etc) or from the upcoming data platform Wikidata. As the information may change many times, allowing fine grained access is extremely valuable compared to the DbPedia implementation.

How Memento Works
This extension accesses older articles by implementing support for the Accept-Datetime HTTP header to perform content negotiation in the date-time dimension, built on the principles of RFC 2295. This enables MediaWiki to be used as a web archive. The IETF Memento Internet Draft provides complete technical information about the Memento framework.

The extension works in two simple steps:
 * When an article is requested by a client, this extension will return the URL to a TimeGate in the HTTP Link header.
 * Upon navigating to the TimeGate, it redirects the client to the version of the requested resource that was the live version at the date-time expressed.

The date-time should be expressed as a value of the Accept-Datetime HTTP header. The Memento Time Travel extension for Chrome Browser can be used to set this date-time value and browse the past web, thus making your web browser a time machine.

This MediaWiki extension uses the same handlers as the MediaWiki software to connect to the database. Hence all the existing database permissions and page access permissions are honored. It uses a 'DB_SLAVE' database connection, which means that the database connection can only read from the tables. Therefore, this plug-in makes no changes to the data in the wiki.

Download instructions
Download and unzip the file Memento.zip.

Installation
To install this package within MediaWiki perform the following:
 * Copy the Memento directory into the extensions directory of your MediaWiki installation.
 * Add the following to the LocalSettings.php file in your MediaWiki installation:

Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

Configuration parameters
This extension has sensible defaults, but also allows the following settings to be added to LocalSettings.php in order to alter its behavior:


 * $wgMementoTimemapNumberOfMementos - (default is 500) allows the user to alter the number of Mementos included in a TimeMap served up by this extension.


 * $wgMementoErrorPageType - has two values for the type of error pages sent to the client:
 * friendly - (default) display MediaWiki-style error pages for error conditions along with a HTTP 200 OK status code returned to the client.
 * traditional - display bare text error pages for error conditions along with the appropriate HTTP 400, HTTP 404, etc. status code returned to the client.


 * $wgMementoTimeNegotiation - has two values for the type of Memento Time Negotiation performed:
 * 302</tt> - (default) Time Negotiation is performed via redirection to the memento URL. See Memento RFC - Pattern 1.1.
 * 200</tt> - Time Negotiation is performed in place, replacing the given wiki page with its Memento if an Accept-Datetime header is sent by the client. See Memento RFC - Pattern 1.2.


 * $wgMementoRecomendedRelations</tt> - mandatory Memento relations in the Link header are always provided, but this is a boolean true/false toggle for the use of RECOMMENDED Memento link relations from the Memento RFC.
 * false</tt> - (default) return none of the RECOMMENDED link relations in the Link header to the client.
 * true</tt> - return all of the RECOMMENDED link relations (first memento, last memento, from, until, etc.) in the Link header to the client; note that this can be computationally expensive and may affect performance on a heavy usage site.


 * $wgMementoExcludeNamespaces</tt> - is an array of MediaWiki Namespace IDs (e.g. the integer values for Talk, Template, etc.) to exclude from Mementofication (default is an empty array); the list of MediaWiki Namespace IDs is at | Manual:Namespace.

Server Setup
In addition to the default MediaWiki installation, this plugin will also work in a setup with URL rewriting. This plugin will also work with wikis in a proxy setup.

TimeGates, TimeMaps and their Workings
This extension introduces two new resources to your MediaWiki installation:
 * 1) TimeGate: A resource that enables transparent time negotiations. This resource decides on the basis of a given datetime, which Memento best matches what the original article was like around the given datetime. When visiting any article in your wiki, this extension adds the URL of the article's TimeGate in the HTTP Link</tt> header. By default, the TimeGate URL is the same as the article URL. When an article is requested with the Accept-Datetime</tt> HTTP header, the resource acts as a TimeGate and returns the appropriate Memento for the article.
 * 2) TimeMap: A TimeMap for an article is a resource from which a list of URIs of Mementos of the article is available. The URI list is serialized in application/link-format. The TimeMap is paged: for articles with many revisions, the TimeMap will only return the number of Mementos specified by the configuration parameter $wgMementoTimemapNumberOfMementos</tt>. TimeMap URLs to retrieve additional mementos are provided in the TimeMap with the rel</tt> attribute "timemap". Please refer to Memento RFC Pattern 6 for more details. Like the TimeGate, the URL to the TimeMap is also available in the Link header and the URL format is: http://your.wikiserver.here/index.php/Special:TimeMap/Title

Usage
The best way to experience this extension is by installing Memento Time Travel for the Chrome browser. After installing Memento Time Travel, enter the URL of a page in your wiki and set the desired date-time. Memento Time Travel will use the TimeGate installed in the wiki to load the version of the article that was live at the requested date-time.

After setting the date-time in Memento Time Travel, a user can click both the internal and external links in the page and navigate the web in the past.

This extension can also be used and tested in two other ways:


 * 1) Using a Firefox browser: Install the Modify Headers Firefox extension. Then set the Accept-Datetime</tt> header from the Tools/Modify Headers menu option. The syntax to use is Accept-Datetime: Sat, 03 Oct 2009 10:00:00 GMT</tt>. Set it to a date-time at which your wiki was already generating history pages. Then enter a URL of a page from your wiki that has associated history pages around the date-time you chose. Using the Live HTTP Headers Firefox Extension, the request and response headers involved in this transaction can be seen. The URL to the TimeGate can be obtained from the <Link> header, using this extension. This URL can be used to navigate to the TimeGate.
 * 2) Using the UNIX command line tool curl</tt>:

For complete information about the memento framework and it's request - response headers, please refer to the IETF Memento Internet Draft.

Templates
MediaWiki, by default, retrieves the most recent version of a template when transcluded in an article. This extension allows datetime content negotiations on transcluded templates.

Special Pages
Special pages under the URL http://your.wikiserver.here/index.php/Special:SpecialPages do not have a history, i.e. there are no revisions to these pages. Hence, the Memento extension cannot perform time negotiations on these resources.

Deleted Contributions
This plugin does not make any deleted revisions accessible.

Timestamps
This extension searches for and retrieves the mementos using the modified time of an article. Timestamps are not unique identifiers and it is possible that an article will have more than one revision at any given time. This extension handles this situation by redirecting to the revision that has the highest revision id.

MediaWiki does not resolve deleted revisions using revision ids, but use timestamps instead in their URIs. Hence, we could not come up with a way to resolve a situation when more than one deleted revision has the same timestamp.

Wikis with Memento Plug-in Installed

 * Demo Wiki
 * DCMI Wiki