Extension:TotalRevisions
From MediaWiki.org
| This extension stores its source code on a wiki page. Please be aware that this code may be unreviewed or maliciously altered. They may contain security holes, outdated interfaces that are no longer compatible etc. Note: No localisation updates are provided for this extension by translatewiki.net. |
|
TotalRevisions Release status: unstable |
|||
|---|---|---|---|
| Implementation | Variable | ||
| Description | Variable to get the total number of revisions for the current page. | ||
| Author(s) | Robert Leverington (RobertLtalk) | ||
| MediaWiki | 1.11.x | ||
| License | No license specified | ||
| Download | Source code Change log |
||
|
|||
| Check usage and version matrix | |||
The TotalRevisions extension adds a variable that returns the total number of revisions for the current page.
This extension is known to cause incompatibilities with other extensions and is no longer being developed. You are advised not to use this extension.
Contents |
Installation [edit]
- Place the source code into
$IP/extensions/TotalRevisions/TotalRevisions.php. - Add
require_once $IP . '/extensions/TotalRevisions/TotalRevisions.php';toLocalSettings.php.
Usage [edit]
Add {{TOTALREVISIONS}} to a page you want to view the total revisions of.
Source code [edit]
TotalRevisions.php [edit]
<?php if( !defined( "MEDIAWIKI" ) ) die( "Invalid entry point." ); define( "MAG_TOTALREVISIONS", "totalrevisions"); $wgHooks[ "LanguageGetMagic" ][] = "wfTotalRevisionsDefine"; function wfTotalRevisionsDefine( &$aWikiWords, &$langID ) { $aWikiWords[ MAG_TOTALREVISIONS ] = array( 0, "TotalRevisions" ); return true; } $wgHooks[ "ParserGetVariableValueSwitch" ][] = "wfTotalRevisionsAssign"; function wfTotalRevisionsAssign( &$parser, &$cache, &$magicWordId, &$ret ) { if( MAG_TOTALREVISIONS == $magicWordId ) { global $wgTitle; $dbr =& wfGetDB( DB_SLAVE ); $ret = $dbr->estimateRowCount( "revision", "*", array( "rev_page" => $wgTitle->getArticleID() ) );; return true; } else { return false; } } $wgExtensionCredits[ "variable" ][] = array( "name" => "TotalRevisions", "description" => "Get the total number of revisions of the current page.", "author" => "Robert Leverington", "url" => "http://www.mediawiki.org/wiki/Extension:TotalRevisions", "version" => "1.1", ); $wgHooks[ "MagicWordwgVariableIDs" ][] = "wfTotalRevisionsDeclare"; function wfTotalRevisionsDeclare( &$aCustomVariableIds ) { $aCustomVariableIds[] = MAG_TOTALREVISIONS; return true; }
Change log [edit]
| Version | Release date | Comments |
|---|---|---|
| 1.1 | 2007-12-17 | Original version. |