*/
$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.
*
$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 );
*/
use Wikimedia\Rdbms\IDatabase;
-use MediaWiki\MediaWikiServices;
/**
* This abstract class implements many basic API functions, and is the base of
}
if ( $errors ) {
- // track block notices
- if ( $this->getConfig()->get( 'EnableBlockNoticeStats' ) ) {
- $this->trackBlockNotices( $errors );
- }
-
if ( !empty( $options['autoblock'] ) ) {
$user->spreadAnyEditBlock();
}
}
}
- /**
- * 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().