Send log entries to CheckUser

Because our log is restricted, we don't publish it to RecentChanges,
so it never ends up in CU. Let's be consistent and log these to
CheckUser as well.

Bug: T301992
Change-Id: I37dac4ecdcf70368f416fc2983afbb4238c19bb2
This commit is contained in:
Kunal Mehta 2022-02-17 23:35:18 -08:00 committed by Dreamy Jazz
parent 519387f7b6
commit 152c80c2cf
3 changed files with 14 additions and 0 deletions

View file

@ -4,12 +4,14 @@ $cfg = require __DIR__ . '/../vendor/mediawiki/mediawiki-phan-config/src/config.
$cfg['directory_list'] = array_merge(
$cfg['directory_list'],
[
'../../extensions/CheckUser',
'../../extensions/Echo',
]
);
$cfg['exclude_analysis_directory_list'] = array_merge(
$cfg['exclude_analysis_directory_list'],
[
'../../extensions/CheckUser',
'../../extensions/Echo',
]
);

View file

@ -2,7 +2,9 @@
namespace MediaWiki\Extension\OATHAuth\Special;
use ExtensionRegistry;
use ManualLogEntry;
use MediaWiki\CheckUser\Hooks as CheckUserHooks;
use MediaWiki\Config\ConfigException;
use MediaWiki\Extension\OATHAuth\OATHUserRepository;
use MediaWiki\HTMLForm\HTMLForm;
@ -151,6 +153,10 @@ class DisableOATHForUser extends FormSpecialPage {
$logEntry->setComment( $formData['reason'] );
$logEntry->insert();
if ( ExtensionRegistry::getInstance()->isLoaded( 'CheckUser' ) ) {
CheckUserHooks::updateCheckUserData( $logEntry->getRecentChange() );
}
LoggerFactory::getInstance( 'authentication' )->info(
'OATHAuth disabled for {usertarget} by {user} from {clientip}', [
'user' => $this->getUser()->getName(),

View file

@ -2,7 +2,9 @@
namespace MediaWiki\Extension\OATHAuth\Special;
use ExtensionRegistry;
use ManualLogEntry;
use MediaWiki\CheckUser\Hooks as CheckUserHooks;
use MediaWiki\Config\ConfigException;
use MediaWiki\Extension\OATHAuth\OATHUserRepository;
use MediaWiki\HTMLForm\HTMLForm;
@ -131,6 +133,10 @@ class VerifyOATHForUser extends FormSpecialPage {
$logEntry->setComment( $formData['reason'] );
$logEntry->insert();
if ( ExtensionRegistry::getInstance()->isLoaded( 'CheckUser' ) ) {
CheckUserHooks::updateCheckUserData( $logEntry->getRecentChange() );
}
LoggerFactory::getInstance( 'authentication' )->info(
'OATHAuth status checked for {usertarget} by {user} from {clientip}', [
'user' => $this->getUser()->getName(),