mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-12-18 10:53:01 +00:00
81e9cb99c0
Why: - There are issues with the current "showcaptcha" action, and we need to disable it until the problems are fixed What: - Define a feature flag to enable custom actions. For now, nothing is enabled. Bug: T20110 Change-Id: I3484d66298bc9f49dfbe003a0605e2ac1a092e10
29 lines
839 B
PHP
29 lines
839 B
PHP
<?php
|
|
|
|
namespace MediaWiki\Extension\ConfirmEdit;
|
|
|
|
use MediaWiki\Config\Config;
|
|
use MediaWiki\Extension\AbuseFilter\Consequences\Parameters;
|
|
use MediaWiki\Extension\AbuseFilter\Hooks\AbuseFilterCustomActionsHook;
|
|
use MediaWiki\Extension\ConfirmEdit\AbuseFilter\CaptchaConsequence;
|
|
|
|
class AbuseFilterHooks implements AbuseFilterCustomActionsHook {
|
|
|
|
private Config $config;
|
|
|
|
public function __construct( Config $config ) {
|
|
$this->config = $config;
|
|
}
|
|
|
|
/** @inheritDoc */
|
|
public function onAbuseFilterCustomActions( array &$actions ): void {
|
|
$enabledActions = $this->config->get( 'ConfirmEditEnabledAbuseFilterCustomActions' );
|
|
if ( in_array( 'showcaptcha', $enabledActions ) ) {
|
|
$actions['showcaptcha'] = static function ( Parameters $params ): CaptchaConsequence {
|
|
return new CaptchaConsequence( $params );
|
|
};
|
|
}
|
|
}
|
|
|
|
}
|