From dadaf0ac2c19e5c92db632a07c60b37ce548cbde Mon Sep 17 00:00:00 2001 From: Dayllan Maza Date: Wed, 17 Apr 2019 15:04:15 -0400 Subject: [PATCH] Remove block notice tracking 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 | 10 ---------- includes/EditPage.php | 7 ------- includes/api/ApiBase.php | 30 ------------------------------ 3 files changed, 47 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 418b1b169d..b7dc712c65 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -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. * diff --git a/includes/EditPage.php b/includes/EditPage.php index 6990934c1d..1d9ff05240 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -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 ); diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 528ced81f6..8ab92aff4b 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -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(). -- 2.20.1