Difference between revisions of "WikiDebug/show revision"

From TestWiki
Jump to: navigation, search
m (moved WikiDebug/show version to WikiDebug/show revision: Tag has been renamed. Old name still exists but is deprecated.)
(Updating to reflect new name.)
Line 1: Line 1:
IMPORTANT NOTE - THIS WILL BE RENAMED TO '''show_revision''' IN THE NEXT RELEASE!
 
 
 
The [[Debugging tools|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.   
 
The [[Debugging tools|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 - 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 [[talk:Debugging tools/show version|the talk page]].''
+
''Note - this used to be known as <code>&lt;show_version&gt;</code>, 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 [[talk:Debugging tools/show version|the talk page]].
  
 
== Syntax ==
 
== Syntax ==
  
<html4strict><show_version file="{FileName}" /></html4strict>
+
<html4strict><show_revision file="{FileName}" /></html4strict>
  
 
* {FileName} is the name of a file residing on the server.
 
* {FileName} is the name of a file residing on the server.
Line 22: Line 22:
 
The following code shows the current revision of the WikiDebug.php file, which contains the SVN revision string <code>$Rev: X $</code> (where X is the current revision number):
 
The following code shows the current revision of the WikiDebug.php file, which contains the SVN revision string <code>$Rev: X $</code> (where X is the current revision number):
  
<html4strict>Result: <show_version file="WikiDebug.php" /></html4strict>
+
<html4strict>Result: <show_revision file="WikiDebug.php" /></html4strict>
  
Result: <show_version file="WikiDebug.php" />
+
Result: <show_revision file="WikiDebug.php" />
  
 
== Example 2: Non-viewable file ==
 
== Example 2: Non-viewable file ==
Line 30: Line 30:
 
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:
 
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:
  
<html4strict>Result: <show_version file="LocalSettings.php" /></html4strict>
+
<html4strict>Result: <show_revision file="LocalSettings.php" /></html4strict>
Result: <show_version file="LocalSettings.php" />
+
Result: <show_revision file="LocalSettings.php" />
  
 
== Example 3: File with no revision number ==
 
== Example 3: File with no revision number ==
Line 37: Line 37:
 
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:
 
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:
  
<html4strict>Result: <show_version file="SomeFileWithoutRevision.php" /></html4strict>
+
<html4strict>Result: <show_revision file="SomeFileWithoutRevision.php" /></html4strict>
 
Result: ''(version unknown)''
 
Result: ''(version unknown)''

Revision as of 00:56, 8 February 2016

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)