WikiDebug/show revision

From TestWiki
Jump to: navigation, search

The WikiDebug extension adds a new tag that allows you to display the Subversion revision number of a specified file. It currently detects and reports the first instance of any of the following SVN keywords (which are all aliases for the current file revision): Rev, LastChangedRevision, Revision.

Note - this used to be known as <show_version>, but has now been renamed. For now, the old name remains as an alias, but it may be removed in the future.

If you know of any other common version strings that it would be useful to add to this list (e.g. those used by other revision control systems) then please let me know via the talk page.


<show_revision file="{FileName}" />
  • {FileName} is the name of a file residing on the server.

As a security measure this extension will only allow display of tables added to the $wgWikiDebug_ViewableFiles array. Any other files are blocked.

For example, to view the version number for the file containing this extension, you would need to add the following to LocalSettings.php:

$wgWikiDebug_ViewableFiles[] = "WikiDebug.php";

Note that paths are relative to the current include path, which includes the extensions directory on this wiki, but which may not on yours.

Example 1: WikiDebug.php[edit]

The following code shows the current revision of the WikiDebug.php file, which contains the SVN revision string $Rev: X $ (where X is the current revision number):

Result: <show_revision file="WikiDebug.php" />

Result: (rev 2047)

Example 2: Non-viewable file[edit]

Here is an attempt to view LocalSettings.php. Because this file is not in the array of allowed files, you are unable to see it's contents:

Result: <show_revision file="LocalSettings.php" />

Result: (File cannot be viewed. It either does not exist, or is protected against viewing.)

Example 3: File with no revision number[edit]

There are currently no viewable files on the wiki which do not have a revision number, but if you were to use the tag to view such a file, you would get the following:

Result: <show_revision file="SomeFileWithoutRevision.php" />

Result: (version unknown)