diff options
author | jenkins-bot <jenkins-bot@gerrit.wikimedia.org> | 2018-11-28 19:55:12 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@wikimedia.org> | 2018-11-28 19:55:12 +0000 |
commit | 2cf4a2c2966d5679cd8935a0807bba1fe21a7381 (patch) | |
tree | 2c528aad919538cc0b494b7f9bda1bd4e8d7a53e | |
parent | 7b7676657dd57074254c341d21d798dcaccd84ba (diff) | |
parent | 49bb28b557e08ef564459665fab461e75376c5c6 (diff) | |
download | mediawikicore-2cf4a2c2966d5679cd8935a0807bba1fe21a7381.tar.gz mediawikicore-2cf4a2c2966d5679cd8935a0807bba1fe21a7381.zip |
Merge "Add block notice stats on EditPage."
-rw-r--r-- | includes/DefaultSettings.php | 10 | ||||
-rw-r--r-- | includes/EditPage.php | 23 |
2 files changed, 26 insertions, 7 deletions
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 5175543e223e..44c53646e29c 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -9055,6 +9055,16 @@ $wgChangeTagsSchemaMigrationStage = MIGRATION_NEW; $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; + +/** * For really cool vim folding this needs to be at the end: * vim: foldmarker=@{,@} foldmethod=marker * @} diff --git a/includes/EditPage.php b/includes/EditPage.php index 5f4c3aeb87af..9e278afcf81b 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -627,14 +627,23 @@ class EditPage { if ( $permErrors ) { wfDebug( __METHOD__ . ": User can't edit\n" ); - // track block with a cookie if it doesn't exists already - $this->context->getUser()->trackBlockWithCookie(); + if ( $this->context->getUser()->getBlock() ) { + // track block with a cookie if it doesn't exists already + $this->context->getUser()->trackBlockWithCookie(); + + // Auto-block user's IP if the account was "hard" blocked + if ( !wfReadOnly() ) { + DeferredUpdates::addCallableUpdate( function () { + $this->context->getUser()->spreadAnyEditBlock(); + } ); + } - // Auto-block user's IP if the account was "hard" blocked - if ( !wfReadOnly() ) { - DeferredUpdates::addCallableUpdate( function () { - $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 ); |