Extension:RecentActivity
Release status: stable |
|
|---|---|
| Implementation | Parser function |
| Description | Adds a parser function to list recently created or edited articles, with optional filtering by user, namespace, and exclusion category. |
| Author(s) | |
| Latest version | 1.9.0 |
| MediaWiki | 1.39+ |
| PHP | 8.0+ |
| Database changes | No |
|
|
|
| Licence | GNU General Public License 2.0 or later |
| Download | GitLab: |
| Translate the RecentActivity extension | |
The RecentActivity extension adds the {{#RecentActivity:}} parser function, which queries the database for recently edited or recently created articles and returns a wikitext list. Results can be filtered by user, restricted to specific namespaces, and pages can be excluded via a category.
This version is a modernised fork of the original Extension:RecentActivity by Aran Dunkley, updated for compatibility with MediaWiki 1.39+ and PHP 8.0+.
Installation
[edit]- Download extension from GitLab and place the file(s) in a directory called
RecentActivityin yourextensions/folder. - Add the following code at the bottom of your LocalSettings.php file:
wfLoadExtension( 'RecentActivity' );
- Configure as required.
Done – Navigate to Special:Versionon your wiki to verify that the extension is successfully installed.
Configuration
[edit]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. Pass an array of namespace ID integers. If empty (the default), pages from all namespaces are included.
- Type: array of integers
- Default:
[](all namespaces)
// Return only pages from the main namespace (0) and Project namespace (4)
$wgRANamespaces = [ 0, 4 ];
- This is the recommended way to exclude media files from results — set
$wgRANamespaces = [ 0 ]to return only main-namespace articles.
Usage
[edit]The extension registers the {{#RecentActivity:}} parser function. All parameters are optional and passed as named arguments.
Parameters
[edit]| Parameter | Description | Default |
|---|---|---|
type |
edits for recently edited pages, new for recently created pages |
(required — returns nothing if omitted) |
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
[edit]- 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=**}}
Debugging
[edit]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';
