Page MenuHomeWickedGov Phorge

RegistrationCallback.php
No OneTemporary

Size
3 KB
Referenced Files
None
Subscribers
None

RegistrationCallback.php

<?php
namespace MediaWiki\Extension\AbuseFilter\Hooks\Handlers;
/**
* This class runs a callback when the extension is registered, right after configuration has been
* loaded (not really a hook, but almost).
* @codeCoverageIgnore Mainly deprecation warnings and other things that can be tested by running the updater
*/
class RegistrationCallback {
public static function onRegistration(): void {
global $wgAbuseFilterProfile,
$wgAbuseFilterProfiling, $wgAbuseFilterPrivateLog, $wgAbuseFilterForceSummary,
$wgGroupPermissions, $wgAbuseFilterRestrictions, $wgAbuseFilterDisallowGlobalLocalBlocks,
$wgAbuseFilterActionRestrictions, $wgAbuseFilterLocallyDisabledGlobalActions;
// @todo Remove this in a future release (added in 1.33)
if ( $wgAbuseFilterProfile !== null || $wgAbuseFilterProfiling !== null ) {
wfWarn( '$wgAbuseFilterProfile and $wgAbuseFilterProfiling have been removed and ' .
'profiling is now enabled by default.' );
}
if ( $wgAbuseFilterPrivateLog !== null ) {
global $wgAbuseFilterLogPrivateDetailsAccess;
$wgAbuseFilterLogPrivateDetailsAccess = $wgAbuseFilterPrivateLog;
wfWarn( '$wgAbuseFilterPrivateLog has been renamed to $wgAbuseFilterLogPrivateDetailsAccess. ' .
'Please make the change in your settings; the format is identical.'
);
}
if ( $wgAbuseFilterForceSummary !== null ) {
global $wgAbuseFilterPrivateDetailsForceReason;
$wgAbuseFilterPrivateDetailsForceReason = $wgAbuseFilterForceSummary;
wfWarn( '$wgAbuseFilterForceSummary has been renamed to ' .
'$wgAbuseFilterPrivateDetailsForceReason. Please make the change in your settings; ' .
'the format is identical.'
);
}
$found = false;
foreach ( $wgGroupPermissions as &$perms ) {
if ( array_key_exists( 'abusefilter-private', $perms ) ) {
$perms['abusefilter-privatedetails'] = $perms[ 'abusefilter-private' ];
unset( $perms[ 'abusefilter-private' ] );
$found = true;
}
if ( array_key_exists( 'abusefilter-private-log', $perms ) ) {
$perms['abusefilter-privatedetails-log'] = $perms[ 'abusefilter-private-log' ];
unset( $perms[ 'abusefilter-private-log' ] );
$found = true;
}
}
unset( $perms );
if ( $found ) {
wfWarn( 'The group permissions "abusefilter-private-log" and "abusefilter-private" have ' .
'been renamed, respectively, to "abusefilter-privatedetails-log" and ' .
'"abusefilter-privatedetails". Please update the names in your settings.'
);
}
// @todo Remove this in a future release (added in 1.36)
if ( $wgAbuseFilterDisallowGlobalLocalBlocks !== null ) {
wfWarn( '$wgAbuseFilterDisallowGlobalLocalBlocks has been removed and replaced by ' .
'$wgAbuseFilterLocallyDisabledGlobalActions. You can now specify which actions to disable. ' .
'If you had set the former to true, you should set to true all of the actions in ' .
'$wgAbuseFilterRestrictions (if you were manually setting the variable) or ' .
'ConsequencesRegistry::DANGEROUS_ACTIONS. ' .
'If you had set it to false (or left the default), just remove it from your wiki settings.'
);
if ( $wgAbuseFilterDisallowGlobalLocalBlocks === true ) {
$wgAbuseFilterLocallyDisabledGlobalActions = [
'throttle' => false,
'warn' => false,
'disallow' => false,
'blockautopromote' => true,
'block' => true,
'rangeblock' => true,
'degroup' => true,
'tag' => false
];
}
}
// @todo Remove this in a future release (added in 1.36)
if ( $wgAbuseFilterRestrictions !== null ) {
wfWarn( '$wgAbuseFilterRestrictions has been renamed to $wgAbuseFilterActionRestrictions.' );
$wgAbuseFilterActionRestrictions = $wgAbuseFilterRestrictions;
}
}
}

File Metadata

Mime Type
text/x-php
Expires
Oct 4 2026, 02:52 (4 w, 6 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
06/48/56747551745737023d46b0e83311
Default Alt Text
RegistrationCallback.php (3 KB)

Event Timeline