Add LogLine hook as per described in the updates to docs/hooks.txt
authorNick Jenkins <nickj@users.mediawiki.org>
Thu, 1 Nov 2007 07:02:02 +0000 (07:02 +0000)
committerNick Jenkins <nickj@users.mediawiki.org>
Thu, 1 Nov 2007 07:02:02 +0000 (07:02 +0000)
RELEASE-NOTES
docs/hooks.txt
includes/SpecialLog.php

index b2976cc..2b1f26a 100644 (file)
@@ -47,6 +47,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * 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 ===
 
index 559f2c4..d1216bb 100644 (file)
@@ -540,6 +540,17 @@ $user: the User object being authenticated against
 $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 09a49c0..4ba0faf 100644 (file)
@@ -394,7 +394,7 @@ class LogViewer {
                        } 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 @@ class LogViewer {
                                }
                                # 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.
                        }
                }