From 9653f9b1d5f0caf3cab31b70e79a29d768767942 Mon Sep 17 00:00:00 2001 From: Glaisher Date: Fri, 13 May 2016 22:44:34 +0500 Subject: [PATCH] LogEventsList::showLogExtract: allow providing custom URL parameters for "view full log" link Optional 'extraUrlParams' parameter has been added. This is useful for example when you want to link to subtypes: Special:Log/foo?subtype=bar. Also change Special:Log link to linkKnown() instead of link() while at it. Change-Id: I87a6403eb0639c4d93e49d6946b85650f478107b --- includes/logging/LogEventsList.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/includes/logging/LogEventsList.php b/includes/logging/LogEventsList.php index da5527eb9a..f29c9e472b 100644 --- a/includes/logging/LogEventsList.php +++ b/includes/logging/LogEventsList.php @@ -553,6 +553,7 @@ class LogEventsList extends ContextSource { * - flags Integer display flags (NO_ACTION_LINK,NO_EXTRA_USER_LINKS) * - useRequestParams boolean Set true to use Pager-related parameters in the WebRequest * - useMaster boolean Use master DB + * - extraUrlParams array|bool Additional url parameters for "full log" link (if it is shown) * @return int Number of total log items (not limited by $lim) */ public static function showLogExtract( @@ -567,6 +568,7 @@ class LogEventsList extends ContextSource { 'flags' => 0, 'useRequestParams' => false, 'useMaster' => false, + 'extraUrlParams' => false, ]; # The + operator appends elements of remaining keys from the right # handed array to the left handed, whereas duplicated keys are NOT overwritten. @@ -578,6 +580,8 @@ class LogEventsList extends ContextSource { $msgKey = $param['msgKey']; $wrap = $param['wrap']; $flags = $param['flags']; + $extraUrlParams = $param['extraUrlParams']; + $useRequestParams = $param['useRequestParams']; if ( !is_array( $msgKey ) ) { $msgKey = [ $msgKey ]; @@ -664,7 +668,11 @@ class LogEventsList extends ContextSource { $urlParam['type'] = $types[0]; } - $s .= Linker::link( + if ( $extraUrlParams !== false ) { + $urlParam = array_merge( $urlParam, $extraUrlParams ); + } + + $s .= Linker::linkKnown( SpecialPage::getTitleFor( 'Log' ), $context->msg( 'log-fulllog' )->escaped(), [], -- 2.20.1