For MediaWiki (recent comments | status changes | tags | authors | states | release notes | statistics)
Index: trunk/extensions/StalkerLog/README =================================================================== --- trunk/extensions/StalkerLog/README (revision 41475) +++ trunk/extensions/StalkerLog/README (revision 41476) @@ -14,3 +14,10 @@ to a user via $wgGroupPermissions allows them to view the log. For example, if managers in an office need to see the log but employees shouldn't. + +== Notes == +The UserLogout hook was only modified to include the logging-out user +as of MediaWiki v1.13. As such, the logout hook won't work properly +on versions prior to that. The code fails gracefully and just doesn't +record user logouts. Should work on 1.11 and 1.12 with only this +problem. Before 1.11 isn't tested (and probably wont't work...) \ No newline at end of file Index: trunk/extensions/StalkerLog/StalkerLog.php =================================================================== --- trunk/extensions/StalkerLog/StalkerLog.php (revision 41475) +++ trunk/extensions/StalkerLog/StalkerLog.php (revision 41476) @@ -26,18 +26,22 @@ $wgAdditionalRights[] = 'stalkerlog-view-log'; $wgGroupPermissions['*']['stalkerlog-view-log'] = true; $wgHooks['UserLoginComplete'][] = 'wfStalkerLogin'; -$wgHooks['UserLogoutComplete'][] = 'wfStalkerLogout'; # Log setup $wgLogTypes[] = 'stalkerlog'; $wgLogHeaders['stalkerlog'] = 'stalkerlog-log-text'; $wgLogNames['stalkerlog'] = 'stalkerlog-log-type'; $wgLogRestrictions['stalkerlog'] = 'stalkerlog-view-log'; -$wgLogActions['stalkerlog/login'] = 'stalkerlog-log-login'; -$wgLogActions['stalkerlog/logout'] = 'stalkerlog-log-logout'; +$wgLogActions['stalkerlog/login'] = 'stalkerlog-log-login'; +# 1.13+ setup only +if ( version_compare( $wgVersion, '1.13', '>=' ) ) { + $wgHooks['UserLogoutComplete'][] = 'wfStalkerLogout'; + $wgLogActions['stalkerlog/logout'] = 'stalkerlog-log-logout'; +} + # Login hook function -function wfStalkerLogin( &$user, &$inject_html ) { +function wfStalkerLogin( &$user ) { wfLoadExtensionMessages('stalkerlog'); $log = new LogPage( 'stalkerlog', false); $log->addEntry( 'login', $user->getUserPage(), '', null, $user );