User:Shawnmjones/MementoHeaders

From mediawiki.org
MediaWiki extensions manual
Memento Headers
Release status: stable
Implementation Data extraction, Interface
Description Provides Memento protocol headers so visitors to your wiki can browse the web as if it were a day in the past.
Author(s) Shawn Jones
Latest version 0.1-SNAPSHOT (2014-08-13)
MediaWiki 1.22.5+
PHP 5.3.8+
Database changes No
License GPL
Download
Example Demo Wiki
See the Configuration section
Translate the Shawnmjones/MementoHeaders extension if it is available at translatewiki.net

Memento allows one to browse the web as if it were a date in the past. The Memento Headers extension provides this support for MediaWiki so that visitors to wikis may seamlessly browse MediaWiki using the Memento Protocol, accessing past revisions of MediaWiki pages as easily as they access past versions of pages on the web archive and the live web. Memento has also been referred to as Time Travel For the Web.

Two MediaWiki extensions provide support for Memento. The table below highlights the differences between them.

Extension:Memento Extension:MementoHeaders
Provides Memento headers for articles
Provides Memento headers for oldid pages
Can exclude namespaces from datetime negotiation
Requires external service for datetime negotiation
Performs datetime negotiation within MediaWiki (TimeGate)
Provides list of revisions in machine-readable format (TimeMap)
Ensures Template revisions match the revision ofthe page in which they are embedded
Ensures image revisions match the revision of the page in which they are embedded(experimental)

This extension only provides the headers for use with an external Memento MediaWiki proxy server, allowing wiki sites to easily support Memento without having to perform Web Time Travel themselves, offloading this additional processing to a Memento Project supported proxy server instead. This extension only provides redirection to oldid pages.

The full Memento Extension provides this Web Time Travel natively, allowing embedded templates and images to time travel as well. If you desire pages to resemble their state in the past, then the full Memento extension may interest you more.

Use Cases[edit]

  • Users often wish to see versions of resources prior to certain events, for example, the page about Michael Jackson in Wikipedia both before and after his death. Also, once they see an old revision of that page, they may want to see what other Wikipedia pages linked from the Michael Jackson page looked like at that same time.
  • MediaWiki is often used as a platform for fan sites. Using this extension will help users avoid spoilers in fan wikis, if they have not yet read a specific book in a series or if a TV season has not yet aired in their country.
  • Studies in changes to the law, such as in the article Same-sex marriage law in the United States by state. One may use this extension to view the laws in California, as they were back in 2008, rather than now.
  • Pages in MediaWikis commonly contain links to the web at large. Sometimes it is helpful, and sometimes necessary (e.g. when links are dead) to see the state of such linked resources at some time in the past, for example, at the time when a linked resource was referenced by the editor. This functionality is supported out of the box by a Memento client and thus not require a MediaWiki to install this Memento extension. However, with the extension installed, temporal navigation is possible both within and outside of the MediaWiki, providing for seamless web time travel.
  • MediaWiki editors can benefit from Memento time travel by being able to easily visit the state of interrelated pages at some time in the past, for example, to assess the differences before and after edit wars.
  • Text mining and data extraction is possible applying to both page-oriented MediaWikis and data wikis such as Wikidata. It allows one to view past versions of data embedded within the wiki, rather than in batch mode like with DBpedia. See also the paper [1] with this regard.
  • MediaWikis are used for scientific purposes, for example, as platforms to provide and maintain terminology definitions. Such definitions may change over time and may be interrelated. From the perspective of scholarly discourse, it may be important to be able to see exactly what the interrelated definitions looked like, for example, when they were used in a scholarly publication.

Installation[edit]

  • Download and place the file(s) in a directory called Shawnmjones in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php file:
    require_once "$IP/extensions/Shawnmjones/Shawnmjones.php";
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Configuration[edit]

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

  • $wgMementoTimeGateURLPrefix - the first part of the TimeGate URL, to which the extension will direct Memento users for datetime negotiation; the default is the Memento-supported TimeGate at http://mementoweb.org/proxy/mediawiki/timegate/
  • $wgMementoIncludeNamespaces - is an array of MediaWiki Namespace IDs (e.g. the integer values for Talk, Template, etc.) to include for Mementofication

The default value of $wgMementoTimeGateURLPrefix is array( 0 ). This means that only the (Main) namespace allows for datetime negotiation. This setting allows one to specify which namespaces are included for use with Memento. For more details on which numbers correspond to which namespaces consult the Namespace article from the MediaWiki Manual.

Server Setup[edit]

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.

Usage[edit]

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 referenced by the wiki to load the version of the article that was live at the requested date-time.

For complete information about the Memento framework and its request - response headers, please refer to the RFC 7089.

Additional Considerations[edit]

Special Pages[edit]

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[edit]

This plugin does not make any deleted revisions accessible.

Timestamps[edit]

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.

Background on Memento[edit]

To gain an understanding about the functionality provided by Memento's time travel, check out this brief overview that includes temporal navigations across Wikipedia and other web sites.

The Memento "Time Travel for the Web" effort started in 2009 with the overall goal of making it as easy to navigate the past of the web as it is to navigate the current web. The basic idea underlying the Memento protocol is that an old version of a web page, such as a version of a Wikipedia article - http://en.wikipedia.org/w/index.php?title=Web_archiving&oldid=526371727 - can be retrieved by accessing its original URI - http://en.wikipedia.org/wiki/Web_archiving - and by applying datetime negotiation to it. Datetime negotiation is similar to content negotiation, which is used frequently by browsers, for example, to ask a server for a version of a page in a specific format e.g. HTML or PDF. Datetime negotiation asks the server for a version with a specific date, and uses the special purpose Accept-Datetime HTTP header to do so.

The Memento protocol is natively supported by several web archives. Also, all versions of DBpedia are natively accessible via the Memento protocol, and proxy support for all language version of Wikipedia has been implemented.

Memento's time travel is not yet natively supported in browsers and hence requires installing an extension. A Memento extension for Chrome, fully compliant with the most recent protocol specification, was released the end of September 2013. A screencam illustrates the extraordinary time travel functionality it provides.

How Memento Works[edit]

This extension allows access to versions of MediaWiki pages by implementing support for the Accept-Datetime HTTP request header to perform datetime negotiation, a variation on content negotiation specified in RFC 2295 [2]. The datetime for negotiation is expressed as a value of the Accept-Datetime HTTP header. The Memento extension for Chrome or the command line mcurl can be used to set this datetime value.

Datetime negotiation works in two simple steps:

  • When a client requests a page, this extension will provide the URI of a TimeGate for the page in the HTTP Link header. For this extension the URI provided points to a special MediaWiki proxy supported by the Memento project.
  • When a client navigates to that TimeGate and sends it the desired date-time, the TimeGate provides the client with the revision of the page that existed at the time desired. The datetime of that revision is provided in the Memento-Datetime HTTP response header, along with additional links in the HTTP Link header providing supplemental information; such as first, last, previous, and next revisions.

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.

Wikis with Memento Plug-in Installed[edit]

See also[edit]

  1. An HTTP-Based Versioning Mechanism for Linked Data http://arxiv.org/abs/1003.3661
  2. RFC 2295. http://www.ietf.org/rfc/rfc2295.txt