MediaWiki r38240 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r38239‎ | r38240 (on ViewVC)‎ | r38241 >
Date:16:01, 30 July 2008
Author:demon
Status:old
Tags:
Comment:
Add StalkerLog extension I wrote up for work awhile back (but we never ended up using). Despite the name, it's targeted at corporate wikis for office productivity monitoring, etc.
Modified paths:

Diff [purge]

Index: trunk/extensions/StalkerLog/StalkerLog.i18n.php
===================================================================
--- trunk/extensions/StalkerLog/StalkerLog.i18n.php	(revision 0)
+++ trunk/extensions/StalkerLog/StalkerLog.i18n.php	(revision 38240)
@@ -0,0 +1,13 @@
+<?php
+
+// Internationalization file for Extension:StalkerLog
+
+$messages = array();
+
+$messages['en'] = array(
+				'stalkerlog-desc'       => 'Adds an entry to [[Special:Log]] on user login/logout',
+				'stalkerlog-log-login'  => 'logged in.',
+				'stalkerlog-log-logout' => 'logged out.',
+				'stalkerlog-log-type'   => 'User authentication log',
+				'stalkerlog-log-text'   => 'Below is a log of user login/logout actions',
+);

Property changes on: trunk/extensions/StalkerLog/StalkerLog.i18n.php
___________________________________________________________________
Name: svn:eol-style
   + native

Index: trunk/extensions/StalkerLog/README
===================================================================
--- trunk/extensions/StalkerLog/README	(revision 0)
+++ trunk/extensions/StalkerLog/README	(revision 38240)
@@ -0,0 +1,16 @@
+== Description ==

+StalkerLog is designed to add a log of user login/logout actions

+to the general log pages. Designed primarily for office productivity

+monitoring, etc.

+

+== Setup ==

+* Download the extension from SVN

+* Copy the files to a subdirectory of your extensions folder

+* Add the following line to LocalSettings.php:

+	require_once("extensions/StalkerLog/StalkerLog.php");

+

+== Configuration ==

+A new right of 'stalkerlog-view-log' has been created. Granting this

+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.

Index: trunk/extensions/StalkerLog/StalkerLog.php
===================================================================
--- trunk/extensions/StalkerLog/StalkerLog.php	(revision 0)
+++ trunk/extensions/StalkerLog/StalkerLog.php	(revision 38240)
@@ -0,0 +1,53 @@
+<?php
+/**
+ * Extension:StalkerLog - Log everytime someone logs in or logs out,
+ * great for tracking productivity in offices (or stalking).
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * @author Chad Horohoe <innocentkiller@gmail.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
+ */
+ 
+$wgExtensionCredits['specialpage'][] = array(
+        'name'				=> 'StalkerLog',
+		'version'			=> '0.5',
+        'url'				=> 'http://mediawiki.org/wiki/Extension:StalkerLog',
+        'description'		=> 'Adds an entry to [[Special:Log]] on user login/logout',
+        'author'			=> '[mailto:innocentkiller@gmail.com Chad Horohoe]',
+        'descriptionmsg'	=> 'stalkerlog-desc',
+);
+
+# Basic setup
+$wgExtensionMessagesFiles['stalkerlog'] = dirname(__FILE__) . '/' . 'StalkerLog.i18n.php';
+$wgAdditionalRights[] = 'stalkerlog-view';
+$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';
+
+# Login hook function
+function wfStalkerLogin( &$user, &$inject_html ) {
+	wfLoadExtensionMessages('stalkerlog');
+	$log = new LogPage( 'stalkerlog', false);
+	$log->addEntry( 'login', $user->getUserPage(), '', null, $user );
+	return true;
+}
+
+# Logout hook function
+function wfStalkerLogout( &$user, &$inject_html, $old_name ) {
+	wfLoadExtensionMessages('stalkerlog');
+	$log = new LogPage( 'stalkerlog', false);
+	$log->addEntry( 'logout', Title::newFromText( NS_USER, $old_name ), '', null, User::newFromName( $old_name ) );
+	return true;
+}

Property changes on: trunk/extensions/StalkerLog/StalkerLog.php
___________________________________________________________________
Name: svn:eol-style
   + native

Status & tagging log

  • 15:29, 12 September 2011 Meno25 (Talk | contribs) changed the status of r38240 [removed: ok added: old]
Personal tools
Namespaces
Variants
Views
Actions
Site
Support
Download
Development
Communication
Toolbox