From db4aaa1a3e715c4467730902973b6e154d054d5b Mon Sep 17 00:00:00 2001 From: Dayllan Maza Date: Mon, 5 Aug 2019 17:30:45 -0400 Subject: [PATCH] Add instrumentation to Special:Mute We are already tracking pageviews and with following change we should be able to answer the following questions: * Of the users who land on this page, what percentage of users actually mute or unmute someone * Of the users who mute a user, which option(s) did they check/uncheck in order to mute/unmute the user EventLogging Schema: https://meta.wikimedia.org/wiki/Schema:SpecialMuteSubmit Bug: T224958 Change-Id: I655dbd999fd5d3d8f792c4f53b7cc502fe05afd5 --- docs/hooks.txt | 3 +++ includes/specials/SpecialMute.php | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/docs/hooks.txt b/docs/hooks.txt index d832012df5..5de2dc73f6 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -3205,6 +3205,9 @@ $request: WebRequest object for getting the value provided by the current user $sp: SpecialPage object, for context &$fields: Current HTMLForm fields descriptors +'SpecialMuteSubmit': DEPRECATED since 1.34! Used only for instrumentation on SpecialMute +$data: Array containing information about submitted options on SpecialMute form + 'SpecialNewpagesConditions': Called when building sql query for Special:NewPages. &$special: NewPagesPager object (subclass of ReverseChronologicalPager) diff --git a/includes/specials/SpecialMute.php b/includes/specials/SpecialMute.php index f3ae31a731..77c0710788 100644 --- a/includes/specials/SpecialMute.php +++ b/includes/specials/SpecialMute.php @@ -99,14 +99,20 @@ class SpecialMute extends FormSpecialPage { * @return bool */ public function onSubmit( array $data, HTMLForm $form = null ) { + $hookData = []; foreach ( $data as $userOption => $value ) { + $hookData[$userOption]['before'] = $this->isTargetBlacklisted( $userOption ); if ( $value ) { $this->muteTarget( $userOption ); } else { $this->unmuteTarget( $userOption ); } + $hookData[$userOption]['after'] = (bool)$value; } + // NOTE: this hook is temporary + Hooks::run( 'SpecialMuteSubmit', [ $hookData ] ); + return true; } -- 2.20.1