Extension:Bashfr

What can this extension do?
Like Extension:RandomInclude or RandomText it provides a random quote from a pre-formatted file.

Usage
Merely include this tag within any page at the place you wish to display a random quotation from the bashfr_fortunes file:

Installation

 * Create a folder: mediawiki/extensions/bashfr
 * Create a text file named bashfr.php and paste the php code listed below into it.
 * Get a bashfr_fortunes file from http://www.bashfr.org/bashfr_fortunes

Note: This site is only in French and I could not find any Fortune files there. However, any Fortune text file (such as from this site) can be copied to the /mediawiki/extensions/bashfr directory and renamed bashfr_fortunes and it will work. A Fortunes text file has this format:

I reject your reality and substitute my own... % This is one of those "What the hell am I doing?" moments, over! % We got a robot in the water, he's stuffed with tuna and it's just another day here at Mythbusters.

require_once("$IP/extensions/bashfr/bashfr.php");
 * Edit LocalSettings.php and add:


 * Put tag on the desired pages at the location you wish the quote to appear.

Parameters
None.

Changes to LocalSettings.php
require_once("$IP/extensions/bashfr/bashfr.php");

Bypassing the MediaWiki cache
At this stage it gets a bit tricky, though, due to the automatic caching of pages in MediaWiki. If you save a page with the source code above, the page will be created and placed in the cache with one of the lines in it. This will only change once the source code is changed again. To get around this, I invalidate every page that is older than one day (= 86400 seconds). This can be achieved by placing the following in LocalSettings.php:

Of course it is possible to set this value to a lower number but keep in mind that this will have an impact on server load as pages are regenerated more often rather than pulled from cache.

To help testing the extension without modifying the Cache Epoch, a refresh of a cached page can be forced by appending &action=purge to the URL.