Extension:BackwardsTimeTravel

Deprecation
This extension is a "subset" of the (much more complete) Memento extension, which aims at providing a standard (RFC 7089) feature to retrieve an old version of a resource. However, this extension has some MediaWiki-specific functionalities it would be worth integrating into Memento (see below). Additionaly, the roadmap above is still relevant to improve the MediaWiki implementation of Memento. Possibly the MediaWiki core could also be added parts of these codes to natively show the as-exact-as-possible old versions of a page.

Features in BackwardsTimeTravel it would be worth integrating into Memento:
 * time parser functions (hook ParserGetVariableValueTs)
 * follow moves of a page (and more generally it would be worth thinking about how to follow moves+deletions+undeletions, see also roadmap above)
 * display the rendering of a page at an arbitrary past date, not necessarily only when the page is modified (templates can change, link colours can change, time parser functions change, etc.); this need an additional URL parameter ( for BackwardsTimeTravel,   or   could be better names)

What can this extension do?
The extension BackwardsTimeTravel intends to display the old versions of an article exactly as it was at the time of publishing. Indeed, with the standard version of MediaWiki, displaying an old version of a page retrieve only the old wikitext of the page and use the current versions for the templates, use the current time in the variables, and so on.

In the facts, the rendering with this extension is often very very near of the old version, but it can remain on some pages details which is impossible to retrieve (see issues), like the value of the magic word &#123;{NUMBEROFARTICLES}}.

Features
old refers to the time of publishing.
 * Use the old version of the templates (but the templates shouldn't have been moved or deleted, see also issues and parameters).
 * Use the old time.

Issues and roadmap
So the very very very strict equal rendering (HTML version) of an old version can be different, but the differences should be very very very often minimalist...
 * Currently the color of the links can differ (fix me).
 * It is not always possible to retrieve the old version of a template, because with the play of moves and deletions it is possible to mix any version of a page with any other version of another page and put it on a third page... We are sure to find the correct version if there no moves from another page to this template, and if there is no deletion of the template before the old version. An alternative is to alert the user if the version is possibly unlike the old version or if it is impossible to retrieve a version of a template.
 * It is impossible to retrieve the value of some magic words depending of the statistics of the site, like numberofarticles, numberoffiles, numberofedits, numberofusers, numberofactiveusers, numberofpages, numberofadmins, numberofviews and possibly others.
 * It is impossible to retrieve the dynamic transcluded page like the special pages Newpages or Recentchanges, or CategoryTree or DynamicPageList.
 * About the linked JavaScripts and CSS, the current version of this extension doesn't retrieve the old versions of these pages; we should also retrieve the old versions of the linked pages (imported scripts and styles) local to the wiki.
 * It is impossible to retrieve any old version of JavaScript or CSS out of the wiki.
 * At a sysadmin level, any change in the LocalSetting.php can have an influence in the rendering of the pages and introduce a difference in the rendering of old pages, particularly the cancelling of a parser extension; or the updating of MediaWiki and/or extensions (see the next point).
 * At a developer level, any change about the parser can modify the rendering of old pages.

Usage
If the extension is active by default, the simple fact to display an old version in the history displays it 'exactly' as it was. It is possible to inhibit the extension by adding the parameter softoldid in the address bar.

If the extension is not active by default, it is possible to activate it by adding the parameter hardoldid in the address bar.

It is always possible to add the parameter epoch=yyyymmddhhmmss in the address bar to retrieve the rendering of the page as it was at the date dd/mm/yyyy hh:mm:ss, even if it is not the date of a change of the page.

Download instructions
Please cut and paste the code found below and place it in. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

Installation
To install this extension, add the following to LocalSettings.php:

Configuration parameters

 * $wgBackwardsTimeDefault = true : use this extension by default when displaying an old version in the history (see also use). Warning: the systematic use of this extension can increase the load of the server.