Submitted by alexios on

The famous MediaWiki project (of Wikipedia fame) is a very flexible tool, and like all good tools, people find uses for it the original designers didn't intend. Many people use Wikis as their personal pages, or as a quick, cheap substitute for a CMS. At my work, I maintain a knowledge base using it. Often, people refer to the pages for outstanding work and announcements. Often, I find it necessary to show notifications about planned work or systems status during a specific period of time only.

In CMS terms, this is known as an embargo. This extension adds an embargo feature to Mediawiki. It provides an <embargo> tag that shows its contents:

  • After a certain date (and, optionally, time), and
  • Before another date (and, optionally, time) has passed.

Either of these criteria may be skipped to display content only before a given date, or forever after a given date.

Usage

Remember that ‘embargo’ denotes hiding, not showing. In this context, ‘embargo after’ means ‘don't show after’, and ‘embargo before’ means ‘don't show before’.

Insert Diabolical April Fools Prank Here.

To display a seasonal message:

'Tis the season, etc.

To let people know about an upcoming event until the day of the event:

Yearly systems maintenance coming up! Check your email for details!

Displaying a new message after the event:

Yearly systems maintenance complete!

The date format in attributes before and after follows the rather flexible format of PHP's strtotime() function. In addition dates, you may specify times using the ISO-like YYYY-MM-DD HH:MM format. You may enter US dates in MM-DD-YYYY, but consult the PHP documentation for other options. Don't use relative dates (next Thursday or now + 2 months): these are interpreted with respect to the time the page is shown, not the time it was last edited!

You can use any wikitext whatsoever inside the <embargo>...</embargo> tags.

Installation

Paste the source code into extensions/Embargo/Embargo.php under your MediaWiki installation. Then, load up your LocalSettings.php file and append these two lines:

# Embargo include_once("$IP/extensions/Embargo/Embargo.php");

Source Code

Tags: 

Language: 


Add new comment

Leave a comment