Extension:LastUserLogin

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
Crystal Clear action run.svg
LastUserLogin
Release status: beta
LastUserLogin.png
Implementation Special page, User activity
Description Displays the last time a user logged in
Author(s) Justin G. Cramer, Danila Ulyanov, Thomas Klein, Felipe Schenone
Latest version 1.5 (2018-10-02)
MediaWiki 1.29+
PHP 5.5+
License GNU General Public License 3.0 or later
Download
Added rights
lastlogin
Translate the LastUserLogin extension if it is available at translatewiki.net
Check usage and version matrix.

The LastUserLogin extension introduces a special page that displays a simple table of users and the last time they logged in. This can be useful if your wiki is used as a knowledge base for outside personnel. If you have a requirement that they check the wiki prior to placing a call or email, LastUserLogin can be used to verify that this policy is being enforced.

Installation[edit]

Users of MediaWiki 1.28.x should use the version for MediaWiki 1.27.x
  • Download and place the file(s) in a directory called LastUserLogin in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    wfLoadExtension( 'LastUserLogin' );
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

To users running MediaWiki 1.24 or earlier:

The instructions above describe the new way of installing this extension using wfLoadExtension() If you need to install this extension on these earlier versions (MediaWiki 1.24 and earlier), instead of wfLoadExtension( 'LastUserLogin' );, you need to use:

require_once "$IP/extensions/LastUserLogin/LastUserLogin.php";

Usage[edit]

Once installed, visit Special:LastUserLogin to see the times at which each user last logged in. This extension introduces the 'lastlogin' right which is needed to view the special page, and by default is only granted to admins (sysops).

Notes[edit]

removeUnusedAccounts.php

Adding a log entry for every user login impacts the script maintenance/removeUnusedAccounts.php as the script checks for the number of page-edits, image-uploads and log-entries. However you can patch removeUnusedAccounts.php to ignore the first login which is very common for spam bots:

Original:

if ( CountEdits( $user, false ) == 0 && CountImages( $user, false ) == 0 && CountLogs( $user, false ) == 0 ) {
	# User has no edits or images, mark them for deletion
	$del[] = $user;
	$count++;
}

Change to:

if ( CountEdits( $user, false ) == 0 && CountImages( $user, false ) == 0 && CountLogs( $user, false ) <= 1 ) {
	# User has no edits or images, mark them for deletion
	$del[] = $user;
	$count++;
}

See also[edit]