Remove block notice tracking
authorDayllan Maza <dmaza@wikimedia.org>
Wed, 17 Apr 2019 19:04:15 +0000 (15:04 -0400)
committerDayllan Maza <dmaza@wikimedia.org>
Tue, 23 Apr 2019 21:49:12 +0000 (17:49 -0400)
This is a clean up after collecting the necessary data related to
blocks and how often users see the block notices

See: https://phabricator.wikimedia.org/T189724

Bug: T214214
Depends-On: I047587c064e63e8bd4b933351edfec298f7c7956
Depends-On: I532a0cd95009109ba25caa8dd31badd5c1900da7
Change-Id: Icfa74ad6337c0a4f12ae24b43d36c0e3cb302a3b

includes/DefaultSettings.php
includes/EditPage.php
includes/api/ApiBase.php

index 418b1b1..b7dc712 100644 (file)
@@ -8983,16 +8983,6 @@ $wgActorTableSchemaMigrationStage = SCHEMA_COMPAT_WRITE_BOTH | SCHEMA_COMPAT_REA
  */
 $wgEnablePartialBlocks = false;
 
-/**
- * Enable stats monitoring when Block Notices are displayed in different places around core
- * and extensions.
- *
- * @since 1.34
- * @deprecated 1.34
- * @var bool
- */
-$wgEnableBlockNoticeStats = false;
-
 /**
  * Origin Trials tokens.
  *
index 6990934..1d9ff05 100644 (file)
@@ -637,13 +637,6 @@ class EditPage {
                                                $this->context->getUser()->spreadAnyEditBlock();
                                        } );
                                }
-
-                               $config = $this->context->getConfig();
-                               if ( $config->get( 'EnableBlockNoticeStats' ) ) {
-                                       $wiki = $config->get( 'DBname' );
-                                       $statsd = MediaWikiServices::getInstance()->getStatsdDataFactory();
-                                       $statsd->increment( 'BlockNotices.' . $wiki . '.WikitextEditor.shown' );
-                               }
                        }
                        $this->displayPermissionsError( $permErrors );
 
index 528ced8..8ab92af 100644 (file)
@@ -21,7 +21,6 @@
  */
 
 use Wikimedia\Rdbms\IDatabase;
-use MediaWiki\MediaWikiServices;
 
 /**
  * This abstract class implements many basic API functions, and is the base of
@@ -2138,11 +2137,6 @@ abstract class ApiBase extends ContextSource {
                }
 
                if ( $errors ) {
-                       // track block notices
-                       if ( $this->getConfig()->get( 'EnableBlockNoticeStats' ) ) {
-                               $this->trackBlockNotices( $errors );
-                       }
-
                        if ( !empty( $options['autoblock'] ) ) {
                                $user->spreadAnyEditBlock();
                        }
@@ -2151,30 +2145,6 @@ abstract class ApiBase extends ContextSource {
                }
        }
 
-       /**
-        * Keep track of errors messages resulting from a block
-        *
-        * @param array $errors
-        */
-       private function trackBlockNotices( array $errors ) {
-               $errorMessageKeys = [
-                       'blockedtext',
-                       'blockedtext-partial',
-                       'autoblockedtext',
-                       'systemblockedtext',
-               ];
-
-               $statsd = MediaWikiServices::getInstance()->getStatsdDataFactory();
-
-               foreach ( $errors as $error ) {
-                       if ( in_array( $error[0], $errorMessageKeys ) ) {
-                               $wiki = $this->getConfig()->get( 'DBname' );
-                               $statsd->increment( 'BlockNotices.' . $wiki . '.MediaWikiApi.returned' );
-                               break;
-                       }
-               }
-       }
-
        /**
         * Will only set a warning instead of failing if the global $wgDebugAPI
         * is set to true. Otherwise behaves exactly as self::dieWithError().