From fbb88c7b0337cd956309e2576253e41d326c6686 Mon Sep 17 00:00:00 2001 From: Nick Jenkins Date: Thu, 1 Nov 2007 07:02:02 +0000 Subject: [PATCH] Add LogLine hook as per described in the updates to docs/hooks.txt --- RELEASE-NOTES | 2 ++ docs/hooks.txt | 11 +++++++++++ includes/SpecialLog.php | 5 ++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index b2976ccd97..2b1f26af66 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/docs/hooks.txt b/docs/hooks.txt index 559f2c46da..d1216bb9b2 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -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 diff --git a/includes/SpecialLog.php b/includes/SpecialLog.php index 09a49c0f51..4ba0faf234 100644 --- a/includes/SpecialLog.php +++ b/includes/SpecialLog.php @@ -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. } } -- 2.20.1