Skip to content

Moussa/revquery

 
 

Repository files navigation

RevQuery

RevQuery is an extension for MediaWiki, an open-source wiki software package, written by seb26. The extension adds the revision timestamp of a file to its embedded <img> source URL as a query parameter. This enables Varnish and other caching systems to appropriately recache and display correct thumbnails when a new file revision is made.

For example:

<img alt="Image.png" src="/w/images/0/0a/Image.png" width="100" height="100">

... becomes:

<img alt="Image.png" src="/w/images/0/0a/Image.png?t=20120127161655" width="100" height="100">

RevQuery also adds timestamps to all thumbnails on file pages (including previous revisions).

Installation

The following code should be added to LocalSettings.php:

require_once( "$IP/extensions/RevQuery/RevQuery.php" );

Note: RevQuery requires modifications to be made to your MediaWiki installation.

  • Select a .patch file corresponding to your MediaWiki version and apply it your installation.
  • Available patches (see also tree):

Why does this require patching?

There are no extension hooks in the right places that allow timestamps to be added to URLs. An alternative would be to use the BeforePageDisplay hook; however, this would require the output HTML string to be scraped for <img> tags. The changes in RevQuery patches do not affect other components of the software.

Functionality

  • RevQuery includes two parser functions that provide timestamps, in addition to appending them to image URLs.
    • {{#file-ts:Image.png}} will produce the timestamp of the latest revision (e.g. 20120130222114)
    • {{#filepath-ts:Image.png}} will produce the full URL of the raw file on the server, with appended timestamp (e.g. http://wiki.org/w/images/0/0a/Image.png?t=20120130222114).
  • Timestamps on source URLs can be disabled by setting $wgRevQueryTimestamps to false in LocalSettings.php.

Development

Testing

  • Developed for stable branch (1.18.1), legacy branch (1.17.2) and deprecated version (1.16.5).

TODO

  • Test on 1.18.0, see if 1.18.1 patch can be applied cleanly.
  • {{filepath:}} links; determine whether or not to automatically add timestamps to these, or offer alternative functions (e.g. {{filepathcurrent:}}).

Licensing

All extensions are copyright (c) 2011 seb26. Source code is free to be modified or distributed under the terms of the Modified BSD License. MediaWiki is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation.

About

RevQuery extension for MediaWiki

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%