WikiDebug/show revision

From TestWiki
< WikiDebug
Revision as of 23:56, 7 February 2016 by HappyDog (Talk | contribs) (Updating to reflect new name.)

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.

Syntax

<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

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 2439)

Example 2: Non-viewable file

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

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)