MediaWiki r27093 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r27092‎ | r27093 (on ViewVC)‎ | r27094 >
Date:07:02, 1 November 2007
Author:nickj
Status:old
Tags:
Comment:
Add LogLine hook as per described in the updates to docs/hooks.txt
Modified paths:

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
===================================================================
--- trunk/phase3/docs/hooks.txt	(revision 27092)
+++ trunk/phase3/docs/hooks.txt	(revision 27093)
@@ -540,6 +540,17 @@
 $password: the password being submitted and found wanting
 $retval: a LoginForm class constant with authenticateUserData() return value (SUCCESS, WRONG_PASS, etc)
 
+'LogLine': Processes a single log entry on Special:Log
+$log_type: string for the type of log entry (e.g. 'move'). Corresponds to logging.log_type 
+    database field.
+$log_action: string for the type of log action (e.g. 'delete', 'block', 'create2'). Corresponds
+    to logging.log_action database field.
+$title: Title object that corresponds to logging.log_namespace and logging.log_title database fields.
+$paramArray: Array of parameters that corresponds to logging.log_params field. Note that only $paramArray[0]
+    appears to contain anything.
+&$comment: string that corresponds to logging.log_comment database field, and which is displayed in the UI.
+&$revert: string that is displayed in the UI, similar to $comment.
+
 'LogPageValidTypes': action being logged. DEPRECATED: Use $wgLogTypes
 &$type: array of strings
 
Index: trunk/phase3/includes/SpecialLog.php
===================================================================
--- trunk/phase3/includes/SpecialLog.php	(revision 27092)
+++ trunk/phase3/includes/SpecialLog.php	(revision 27093)
@@ -394,7 +394,7 @@
 			} elseif ( ( $s->log_action == 'protect' || $s->log_action == 'modify' ) && $wgUser->isAllowed( 'protect' ) ) {
 				$revert = '(' .  $skin->makeKnownLinkObj( $title, wfMsg( 'protect_change' ), 'action=unprotect' ) . ')';
 			// show user tool links for self created users
-			// TODO: The extension should be handling this, get it out of core!
+			// @todo The extension should be handling this, get it out of core! E.g. Use the hook below.
 			} elseif ( $s->log_action == 'create2' ) {
 				if( isset( $paramArray[0] ) ) {
 					$revert = $this->skin->userToolLinks( $paramArray[0], $s->log_title, true );
@@ -404,6 +404,9 @@
 				}
 				# Suppress $comment from old entries, not needed and can contain incorrect links
 				$comment = '';
+			} elseif ( wfRunHooks( 'LogLine', array( $s->log_type, $s->log_action, $title, $paramArray, &$comment, &$revert ) ) ) {
+				//wfDebug( "Invoked LogLine hook for " $s->log_type . ", " . $s->log_action . "\n" );
+				// Do nothing. The implementation is handled by the hook modifiying the passed-by-ref parameters.
 			}
 		}
 
Index: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES	(revision 27092)
+++ trunk/phase3/RELEASE-NOTES	(revision 27093)
@@ -47,7 +47,9 @@
 * Allow hiding new pages by logged-in users on Special:Newpages
 * (bug 1405) Add wgUseNPPatrol option to control patroling for new articles
   on Special:Newpages
+* LogLine hook added to allow formatting custom entries in Special:Log.
 
+
 === Bug fixes in 1.12 ===
 
 * Subpages are now indexed for searching properly when using PostgreSQL

Status & tagging log

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