Extension:TotalRevisions
From MediaWiki.org
|
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 (experimental) |
|||
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 |
[edit] Installation
- Place the source code into
$IP/extensions/TotalRevisions/TotalRevisions.php. - Add
require_once $IP . '/extensions/TotalRevisions/TotalRevisions.php';toLocalSettings.php.
[edit] Usage
Add {{TOTALREVISIONS}} to a page you want to view the total revisions of.
[edit] Source code
[edit] TotalRevisions.php
<?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; }
[edit] Change log
| Version | Release date | Comments |
|---|---|---|
| 1.1 | 2007-12-17 | Original version. |