lucamauri / recentactivity
Adds parser functions for listing recently created and edited articles
Package info
gitlab.com/lucamauri/RecentActivity
Type:mediawiki-extension
pkg:composer/lucamauri/recentactivity
Requires (Dev)
This package is auto-updated.
Last update: 2026-08-10 21:24:34 UTC
README
Adds a parser function for listing recently created or edited articles on a MediaWiki wiki.
Why the fork
This fork was created by Luca Mauri from the original RecentActivity extension by Aran Dunkley, hosted on GitLab at gitlab.com/lucamauri/RecentActivity.
The goals of this fork are:
- PHP 8.x compatibility — the original extension used APIs deprecated or removed in PHP 8 and MediaWiki 1.36+
- MediaWiki 1.39+ API modernisation — replaced
wfGetDB(),IDatabase::select(),Title::newFromId(), andrev_user_textcolumn references with current equivalents - Namespace filtering — added
$wgRANamespacesconfiguration variable to allow filtering results by namespace (e.g. excludeFile:pages from results) - Dependency injection — converted the hook handler to use constructor-based dependency injection via
HookHandlersinextension.json, following modern MediaWiki extension standards - Wikibase-aware labels — on wikis running Wikibase Repository, entity pages (
Q42,P17) are shown with their human-readable label instead of the bare entity code (see Wikibase integration below) - Code quality — improved docblocks, comments, i18n of error messages, and overall code readability
The original GitLab repository is preserved for attribution purposes.
Requirements
- MediaWiki 1.39.0 or later
- PHP 8.0 or later
- (Optional) Wikibase Repository, if you want entity pages to display with their label instead of their raw
Qxxx/Pxxxcode — see Wikibase integration below
Installation
Via Composer (recommended)
Add the following to composer.local.json at the root of your MediaWiki installation (create the file if it does not exist):
{
"require": {
"lucamauri/recentactivity": "^1.10"
},
"extra": {
"merge-plugin": {
"include": []
}
}
}
Then run Composer in the root of your MediaWiki installation:
composer install --no-dev
Manual installation
Download the source code from the GitHub releases page and decompress it into a folder named RecentActivity inside the extensions/ directory of your MediaWiki installation.
Activate the extension
Add the following line near the rest of the extension loading calls in LocalSettings.php:
wfLoadExtension( 'RecentActivity' );
Then add any configuration variables you need, as described in the Configuration section below.
Configuration
All configuration variables are optional. Add them to LocalSettings.php after the wfLoadExtension call.
$wgRAExclusionsCat
Pages belonging to this category will be excluded from all results.
- Type:
string - Default:
'Excluded from RecentActivity'
$wgRAExclusionsCat = 'My exclusion category';
$wgRANamespaces
Restrict results to pages in specific namespaces. Use an array of namespace ID integers. If empty (the default), pages from all namespaces are returned.
- Type:
arrayof integers - Default:
[](all namespaces)
// Show only pages from the main namespace (0) and the Project namespace (4)
$wgRANamespaces = [ 0, 4 ];
This is the recommended way to exclude media files from results — set it to [ 0 ] to return only main-namespace articles.
Usage
The extension adds the {{#RecentActivity:}} parser function. All parameters are optional and passed as named arguments.
Parameters
| Parameter | Description | Default |
|---|---|---|
type | edits for recently edited pages, new for recently created pages | (empty — returns nothing) |
user | Filter results to edits or creations by this username | (all users) |
count | Number of results to return | 5 |
format | Wikitext list marker prepended to each result | * |
Examples
Show the last five recently edited articles:
{{#RecentActivity:type=edits}}
Show the last five recently created articles:
{{#RecentActivity:type=new}}
Show the last five articles created by user Foo:
{{#RecentActivity:type=new|user=Foo}}
Show the last ten recently edited articles:
{{#RecentActivity:type=edits|count=10}}
Show recently edited articles with a double-asterisk prefix (useful for tree views):
{{#RecentActivity:type=edits|format=**}}
Wikibase integration
Added in 1.10.0.
If your wiki has the Wikibase Repository extension installed, Item and Property pages are normally titled with their raw entity ID (e.g. Q42, P17), because Wikibase stores human-readable labels separately from the page title itself. Without this integration, such pages would show up in RecentActivity's list as bare Q42 / P17 codes.
RecentActivity detects this automatically — no configuration is needed. When a listed page is a Wikibase entity, it is displayed as:
Label (Q42)
The label is resolved in the viewing user's own interface language first, then falls back through MediaWiki's normal language fallback chain (e.g. Italian → English → the wiki's content language) if no label exists in the user's language. If no label exists in any language, the bare entity code is shown instead, so the output never breaks — it simply behaves as it did before this feature existed.
On a wiki without Wikibase Repository installed, this section doesn't apply and nothing changes: RecentActivity behaves exactly as in earlier versions.
Debugging
Log output is written to the RecentActivity log group. To enable it, add the following to LocalSettings.php:
$wgDebugLogGroups['RecentActivity'] = '/var/log/mediawiki/recentactivity.log';
Credits
Originally developed by Aran Dunkley. Modernised and maintained by Luca Mauri.
Icon
The project icon © 2014 Andreas Kainz & Uri Herrera & Andrew Lake & Marco Martin & Harald Sitter & Jonathan Riddell & Ken Vermette & Aleix Pol & David Faure & Albert Vaca & Luca Beltrame & Gleb Popov & Nuno Pinheiro & Alex Richardson & Jan Grulich & Bernhard Landauer & Heiko Becker & Volker Krause & David Rosca & Phil Schaf / KDE
License
This extension is released under the GNU General Public License, version 2 or later.