mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-23 13:46:48 +00:00
Reduce use of globals in favor of Config
I'd like to have this reviewed by more than one user before merging, to avoid regressions of annoying typos. Change-Id: I91a9c5cca55e540a6c95b750579c1c369a760b15
This commit is contained in:
parent
6558d07eae
commit
45d1d71def
|
@ -298,9 +298,8 @@ class AbuseFilterViewDiff extends AbuseFilterView {
|
|||
$oldVersion['info']['description'],
|
||||
$newVersion['info']['description']
|
||||
);
|
||||
global $wgAbuseFilterValidGroups;
|
||||
if (
|
||||
count( $wgAbuseFilterValidGroups ) > 1 ||
|
||||
count( $this->getConfig()->get( 'AbuseFilterValidGroups' ) ) > 1 ||
|
||||
$oldVersion['info']['group'] != $newVersion['info']['group']
|
||||
) {
|
||||
$info .= $this->getDiffRow(
|
||||
|
|
|
@ -58,6 +58,7 @@ class AbuseFilterViewEdit extends AbuseFilterView {
|
|||
$user = $this->getUser();
|
||||
$out = $this->getOutput();
|
||||
$request = $this->getRequest();
|
||||
$config = $this->getConfig();
|
||||
$out->setPageTitle( $this->msg( 'abusefilter-edit' ) );
|
||||
$out->addHelpLink( 'Extension:AbuseFilter/Rules format' );
|
||||
|
||||
|
@ -167,9 +168,8 @@ class AbuseFilterViewEdit extends AbuseFilterView {
|
|||
}
|
||||
|
||||
// Check for restricted actions
|
||||
global $wgAbuseFilterRestrictions;
|
||||
if ( count( array_intersect_key(
|
||||
array_filter( $wgAbuseFilterRestrictions ),
|
||||
array_filter( $config->get( 'AbuseFilterRestrictions' ) ),
|
||||
array_merge(
|
||||
array_filter( $actions ),
|
||||
array_filter( $origActions )
|
||||
|
@ -244,10 +244,9 @@ class AbuseFilterViewEdit extends AbuseFilterView {
|
|||
}
|
||||
|
||||
// Actions
|
||||
global $wgAbuseFilterActions;
|
||||
$deadActions = [];
|
||||
$actionsRows = [];
|
||||
foreach ( array_filter( $wgAbuseFilterActions ) as $action => $_ ) {
|
||||
foreach ( array_filter( $config->get( 'AbuseFilterActions' ) ) as $action => $_ ) {
|
||||
// Check if it's set
|
||||
$enabled = isset( $actions[$action] ) && (bool)$actions[$action];
|
||||
|
||||
|
@ -447,8 +446,8 @@ class AbuseFilterViewEdit extends AbuseFilterView {
|
|||
array_merge( $readOnlyAttrib, $styleAttrib )
|
||||
);
|
||||
|
||||
global $wgAbuseFilterValidGroups;
|
||||
if ( count( $wgAbuseFilterValidGroups ) > 1 ) {
|
||||
$validGroups = $this->getConfig()->get( 'AbuseFilterValidGroups' );
|
||||
if ( count( $validGroups ) > 1 ) {
|
||||
$groupSelector = new XmlSelect(
|
||||
'wpFilterGroup',
|
||||
'mw-abusefilter-edit-group-input',
|
||||
|
@ -459,7 +458,7 @@ class AbuseFilterViewEdit extends AbuseFilterView {
|
|||
$groupSelector->setDefault( $row->af_group );
|
||||
}
|
||||
|
||||
foreach ( $wgAbuseFilterValidGroups as $group ) {
|
||||
foreach ( $validGroups as $group ) {
|
||||
$groupSelector->addOption( AbuseFilter::nameGroup( $group ), $group );
|
||||
}
|
||||
|
||||
|
@ -486,14 +485,13 @@ class AbuseFilterViewEdit extends AbuseFilterView {
|
|||
|
||||
if ( $filter !== 'new' ) {
|
||||
// Statistics
|
||||
global $wgAbuseFilterProfile;
|
||||
$stash = ObjectCache::getMainStashInstance();
|
||||
$matches_count = (int)$stash->get( AbuseFilter::filterMatchesKey( $filter ) );
|
||||
$total = (int)$stash->get( AbuseFilter::filterUsedKey( $row->af_group ) );
|
||||
|
||||
if ( $total > 0 ) {
|
||||
$matches_percent = sprintf( '%.2f', 100 * $matches_count / $total );
|
||||
if ( $wgAbuseFilterProfile ) {
|
||||
if ( $this->getConfig()->get( 'AbuseFilterProfile' ) ) {
|
||||
list( $timeProfile, $condProfile ) = AbuseFilter::getFilterProfile( $filter );
|
||||
$fields['abusefilter-edit-status-label'] = $this->msg( 'abusefilter-edit-status-profile' )
|
||||
->numParams( $total, $matches_count, $matches_percent, $timeProfile, $condProfile )
|
||||
|
@ -522,18 +520,15 @@ class AbuseFilterViewEdit extends AbuseFilterView {
|
|||
$checkboxes = [ 'hidden', 'enabled', 'deleted' ];
|
||||
$flags = '';
|
||||
|
||||
global $wgAbuseFilterIsCentral;
|
||||
if ( $wgAbuseFilterIsCentral ) {
|
||||
if ( $this->getConfig()->get( 'AbuseFilterIsCentral' ) ) {
|
||||
$checkboxes[] = 'global';
|
||||
}
|
||||
|
||||
if ( isset( $row->af_throttled ) && $row->af_throttled ) {
|
||||
global $wgAbuseFilterRestrictions;
|
||||
|
||||
$filterActions = explode( ',', $row->af_actions );
|
||||
$throttledActions = array_intersect_key(
|
||||
array_flip( $filterActions ),
|
||||
array_filter( $wgAbuseFilterRestrictions )
|
||||
array_filter( $this->getConfig()->get( 'AbuseFilterRestrictions' ) )
|
||||
);
|
||||
|
||||
if ( $throttledActions ) {
|
||||
|
@ -672,9 +667,9 @@ class AbuseFilterViewEdit extends AbuseFilterView {
|
|||
* @return string HTML text for an action editor.
|
||||
*/
|
||||
public function buildConsequenceEditor( $row, $actions ) {
|
||||
global $wgAbuseFilterActions;
|
||||
|
||||
$enabledActions = array_filter( $wgAbuseFilterActions );
|
||||
$enabledActions = array_filter(
|
||||
$this->getConfig()->get( 'AbuseFilterActions' )
|
||||
);
|
||||
|
||||
$setActions = [];
|
||||
foreach ( $enabledActions as $action => $_ ) {
|
||||
|
@ -702,9 +697,9 @@ class AbuseFilterViewEdit extends AbuseFilterView {
|
|||
* @return string
|
||||
*/
|
||||
public function buildConsequenceSelector( $action, $set, $parameters, $row ) {
|
||||
global $wgAbuseFilterActions, $wgMainCacheType;
|
||||
|
||||
if ( empty( $wgAbuseFilterActions[$action] ) ) {
|
||||
$config = $this->getConfig();
|
||||
$actions = $config->get( 'AbuseFilterActions' );
|
||||
if ( empty( $actions[$action] ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
@ -720,7 +715,7 @@ class AbuseFilterViewEdit extends AbuseFilterView {
|
|||
switch ( $action ) {
|
||||
case 'throttle':
|
||||
// Throttling is only available via object caching
|
||||
if ( $wgMainCacheType === CACHE_NONE ) {
|
||||
if ( $config->get( 'MainCacheType' ) === CACHE_NONE ) {
|
||||
return '';
|
||||
}
|
||||
$throttleSettings = Xml::checkLabel(
|
||||
|
@ -763,7 +758,6 @@ class AbuseFilterViewEdit extends AbuseFilterView {
|
|||
);
|
||||
return $throttleSettings;
|
||||
case 'warn':
|
||||
global $wgAbuseFilterDefaultWarningMessage;
|
||||
$output = '';
|
||||
$checkbox = Xml::checkLabel(
|
||||
$this->msg( 'abusefilter-edit-action-warn' )->text(),
|
||||
|
@ -777,9 +771,9 @@ class AbuseFilterViewEdit extends AbuseFilterView {
|
|||
} elseif (
|
||||
$row &&
|
||||
isset( $row->af_group ) && $row->af_group &&
|
||||
isset( $wgAbuseFilterDefaultWarningMessage[$row->af_group] )
|
||||
isset( $config->get( 'AbuseFilterDefaultWarningMessage' )[$row->af_group] )
|
||||
) {
|
||||
$warnMsg = $wgAbuseFilterDefaultWarningMessage[$row->af_group];
|
||||
$warnMsg = $config->get( 'AbuseFilterDefaultWarningMessage' )[$row->af_group];
|
||||
} else {
|
||||
$warnMsg = 'abusefilter-warning';
|
||||
}
|
||||
|
@ -852,9 +846,6 @@ class AbuseFilterViewEdit extends AbuseFilterView {
|
|||
);
|
||||
return $output;
|
||||
case 'block':
|
||||
global $wgBlockAllowsUTEdit, $wgAbuseFilterBlockDuration,
|
||||
$wgAbuseFilterAnonBlockDuration;
|
||||
|
||||
if ( $set && count( $parameters ) === 3 ) {
|
||||
// Both blocktalk and custom block durations available
|
||||
$blockTalk = $parameters[0];
|
||||
|
@ -865,12 +856,12 @@ class AbuseFilterViewEdit extends AbuseFilterView {
|
|||
// Only blocktalk available
|
||||
$blockTalk = $parameters[0];
|
||||
}
|
||||
if ( $wgAbuseFilterAnonBlockDuration ) {
|
||||
$defaultAnonDuration = $wgAbuseFilterAnonBlockDuration;
|
||||
if ( $config->get( 'AbuseFilterAnonBlockDuration' ) ) {
|
||||
$defaultAnonDuration = $config->get( 'AbuseFilterAnonBlockDuration' );
|
||||
} else {
|
||||
$defaultAnonDuration = $wgAbuseFilterBlockDuration;
|
||||
$defaultAnonDuration = $config->get( 'AbuseFilterBlockDuration' );
|
||||
}
|
||||
$defaultUserDuration = $wgAbuseFilterBlockDuration;
|
||||
$defaultUserDuration = $config->get( 'AbuseFilterBlockDuration' );
|
||||
}
|
||||
$suggestedBlocks = SpecialBlock::getSuggestedDurations();
|
||||
$suggestedBlocks = self::normalizeBlocks( $suggestedBlocks );
|
||||
|
@ -883,7 +874,7 @@ class AbuseFilterViewEdit extends AbuseFilterView {
|
|||
$set,
|
||||
[ 'class' => 'mw-abusefilter-action-checkbox' ] + $cbReadOnlyAttrib );
|
||||
$output .= Xml::tags( 'p', null, $checkbox );
|
||||
if ( $wgBlockAllowsUTEdit === true ) {
|
||||
if ( $config->get( 'BlockAllowsUTEdit' ) === true ) {
|
||||
$talkCheckbox =
|
||||
Xml::checkLabel(
|
||||
$this->msg( 'abusefilter-edit-action-blocktalk' )->text(),
|
||||
|
@ -1168,13 +1159,12 @@ class AbuseFilterViewEdit extends AbuseFilterView {
|
|||
$row->af_deleted = $request->getBool( 'wpFilterDeleted' );
|
||||
$row->af_enabled = $request->getBool( 'wpFilterEnabled' ) && !$row->af_deleted;
|
||||
$row->af_hidden = $request->getBool( 'wpFilterHidden' );
|
||||
global $wgAbuseFilterIsCentral;
|
||||
$row->af_global = $request->getBool( 'wpFilterGlobal' ) && $wgAbuseFilterIsCentral;
|
||||
$row->af_global = $request->getBool( 'wpFilterGlobal' )
|
||||
&& $this->getConfig()->get( 'AbuseFilterIsCentral' );
|
||||
|
||||
// Actions
|
||||
global $wgAbuseFilterActions;
|
||||
$actions = [];
|
||||
foreach ( array_filter( $wgAbuseFilterActions ) as $action => $_ ) {
|
||||
foreach ( array_filter( $this->getConfig()->get( 'AbuseFilterActions' ) ) as $action => $_ ) {
|
||||
// Check if it's set
|
||||
$enabled = $request->getBool( 'wpFilterAction' . ucfirst( $action ) );
|
||||
|
||||
|
@ -1248,10 +1238,9 @@ class AbuseFilterViewEdit extends AbuseFilterView {
|
|||
* @return null
|
||||
*/
|
||||
protected function exposeWarningMessages() {
|
||||
global $wgOut, $wgAbuseFilterDefaultWarningMessage;
|
||||
$wgOut->addJsConfigVars(
|
||||
$this->getOutput()->addJsConfigVars(
|
||||
'wgAbuseFilterDefaultWarningMessage',
|
||||
$wgAbuseFilterDefaultWarningMessage
|
||||
$this->getConfig()->get( 'AbuseFilterDefaultWarningMessage' )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,10 +8,9 @@ class AbuseFilterViewList extends AbuseFilterView {
|
|||
* Shows the page
|
||||
*/
|
||||
public function show() {
|
||||
global $wgAbuseFilterCentralDB, $wgAbuseFilterIsCentral;
|
||||
|
||||
$out = $this->getOutput();
|
||||
$request = $this->getRequest();
|
||||
$config = $this->getConfig();
|
||||
|
||||
// Status info...
|
||||
$this->showStatus();
|
||||
|
@ -33,14 +32,17 @@ class AbuseFilterViewList extends AbuseFilterView {
|
|||
$deleted = $request->getVal( 'deletedfilters' );
|
||||
$hidedisabled = $request->getBool( 'hidedisabled' );
|
||||
$defaultscope = 'all';
|
||||
if ( isset( $wgAbuseFilterCentralDB ) && !$wgAbuseFilterIsCentral ) {
|
||||
if ( $config->has( 'AbuseFilterCentralDB' )
|
||||
&& !$config->get( 'AbuseFilterIsCentral' ) ) {
|
||||
// Show on remote wikis as default only local filters
|
||||
$defaultscope = 'local';
|
||||
}
|
||||
$scope = $request->getVal( 'rulescope', $defaultscope );
|
||||
|
||||
$searchEnabled = $this->canViewPrivate() && !( isset( $wgAbuseFilterCentralDB ) &&
|
||||
!$wgAbuseFilterIsCentral && $scope == 'global' );
|
||||
$searchEnabled = $this->canViewPrivate() && !(
|
||||
$config->has( 'AbuseFilterCentralDB' ) &&
|
||||
!$config->get( 'AbuseFilterIsCentral' ) &&
|
||||
$scope == 'global' );
|
||||
|
||||
if ( $searchEnabled ) {
|
||||
$querypattern = $request->getVal( 'querypattern' );
|
||||
|
@ -119,8 +121,7 @@ class AbuseFilterViewList extends AbuseFilterView {
|
|||
* @param array $optarray
|
||||
*/
|
||||
public function showList( $conds = [ 'af_deleted' => 0 ], $optarray = [] ) {
|
||||
global $wgAbuseFilterCentralDB, $wgAbuseFilterIsCentral;
|
||||
|
||||
$config = $this->getConfig();
|
||||
$this->getOutput()->addHTML(
|
||||
Xml::element( 'h2', null, $this->msg( 'abusefilter-list' )->parse() )
|
||||
);
|
||||
|
@ -139,7 +140,11 @@ class AbuseFilterViewList extends AbuseFilterView {
|
|||
$searchmode = '';
|
||||
}
|
||||
|
||||
if ( isset( $wgAbuseFilterCentralDB ) && !$wgAbuseFilterIsCentral && $scope == 'global' ) {
|
||||
if (
|
||||
$config->has( 'AbuseFilterCentralDB' )
|
||||
&& !$config->get( 'AbuseFilterIsCentral' )
|
||||
&& $scope == 'global'
|
||||
) {
|
||||
$pager = new GlobalAbuseFilterPager(
|
||||
$this,
|
||||
$conds,
|
||||
|
@ -169,12 +174,12 @@ class AbuseFilterViewList extends AbuseFilterView {
|
|||
'default' => $deleted,
|
||||
];
|
||||
|
||||
if ( isset( $wgAbuseFilterCentralDB ) ) {
|
||||
if ( $config->has( 'AbuseFilterCentralDB' ) ) {
|
||||
$optionsMsg = [
|
||||
'abusefilter-list-options-scope-local' => 'local',
|
||||
'abusefilter-list-options-scope-global' => 'global',
|
||||
];
|
||||
if ( $wgAbuseFilterIsCentral ) {
|
||||
if ( $config->get( 'AbuseFilterIsCentral' ) ) {
|
||||
// For central wiki: add third scope option
|
||||
$optionsMsg['abusefilter-list-options-scope-all'] = 'all';
|
||||
}
|
||||
|
@ -253,13 +258,11 @@ class AbuseFilterViewList extends AbuseFilterView {
|
|||
* Show stats
|
||||
*/
|
||||
public function showStatus() {
|
||||
global $wgAbuseFilterConditionLimit, $wgAbuseFilterValidGroups;
|
||||
|
||||
$stash = ObjectCache::getMainStashInstance();
|
||||
$overflow_count = (int)$stash->get( AbuseFilter::filterLimitReachedKey() );
|
||||
$match_count = (int)$stash->get( AbuseFilter::filterMatchesKey() );
|
||||
$total_count = 0;
|
||||
foreach ( $wgAbuseFilterValidGroups as $group ) {
|
||||
foreach ( $this->getConfig()->get( 'AbuseFilterValidGroups' ) as $group ) {
|
||||
$total_count += (int)$stash->get( AbuseFilter::filterUsedKey( $group ) );
|
||||
}
|
||||
|
||||
|
@ -272,7 +275,7 @@ class AbuseFilterViewList extends AbuseFilterView {
|
|||
$total_count,
|
||||
$overflow_count,
|
||||
$overflow_percent,
|
||||
$wgAbuseFilterConditionLimit,
|
||||
$this->getConfig()->get( 'AbuseFilterConditionLimit' ),
|
||||
$match_count,
|
||||
$match_percent
|
||||
)->parse();
|
||||
|
|
|
@ -42,8 +42,6 @@ class ApiQueryAbuseLog extends ApiQueryBase {
|
|||
* @see ApiQueryBase::execute()
|
||||
*/
|
||||
public function execute() {
|
||||
global $wgAbuseFilterIsCentral;
|
||||
|
||||
$user = $this->getUser();
|
||||
$errors = $this->getTitle()->getUserPermissionsErrors(
|
||||
'abusefilter-log', $user, true, [ 'ns-specialprotected' ] );
|
||||
|
@ -66,7 +64,8 @@ class ApiQueryAbuseLog extends ApiQueryBase {
|
|||
$fld_timestamp = isset( $prop['timestamp'] );
|
||||
$fld_hidden = isset( $prop['hidden'] );
|
||||
$fld_revid = isset( $prop['revid'] );
|
||||
$fld_wiki = $wgAbuseFilterIsCentral && isset( $prop['wiki'] );
|
||||
$isCentral = $this->getConfig()->get( 'AbuseFilterIsCentral' );
|
||||
$fld_wiki = $isCentral && isset( $prop['wiki'] );
|
||||
|
||||
if ( $fld_ip ) {
|
||||
$this->checkUserRightsAny( 'abusefilter-private' );
|
||||
|
@ -149,7 +148,7 @@ class ApiQueryAbuseLog extends ApiQueryBase {
|
|||
$this->addWhereIf( $notDeletedCond, !SpecialAbuseLog::canSeeHidden() );
|
||||
if ( isset( $params['wiki'] ) ) {
|
||||
// 'wiki' won't be set if $wgAbuseFilterIsCentral = false
|
||||
$this->addWhereIf( [ 'afl_wiki' => $params['wiki'] ], $wgAbuseFilterIsCentral );
|
||||
$this->addWhereIf( [ 'afl_wiki' => $params['wiki'] ], $isCentral );
|
||||
}
|
||||
|
||||
$title = $params['title'];
|
||||
|
@ -259,8 +258,6 @@ class ApiQueryAbuseLog extends ApiQueryBase {
|
|||
* @return array
|
||||
*/
|
||||
public function getAllowedParams() {
|
||||
global $wgAbuseFilterIsCentral;
|
||||
|
||||
$params = [
|
||||
'start' => [
|
||||
ApiBase::PARAM_TYPE => 'timestamp'
|
||||
|
@ -307,7 +304,7 @@ class ApiQueryAbuseLog extends ApiQueryBase {
|
|||
ApiBase::PARAM_ISMULTI => true
|
||||
]
|
||||
];
|
||||
if ( $wgAbuseFilterIsCentral ) {
|
||||
if ( $this->getConfig()->get( 'AbuseFilterIsCentral' ) ) {
|
||||
$params['wiki'] = [
|
||||
ApiBase::PARAM_TYPE => 'string',
|
||||
];
|
||||
|
|
|
@ -81,8 +81,7 @@ class AbuseFilterPager extends TablePager {
|
|||
$headers['af_pattern'] = 'abusefilter-list-pattern';
|
||||
}
|
||||
|
||||
global $wgAbuseFilterValidGroups;
|
||||
if ( count( $wgAbuseFilterValidGroups ) > 1 ) {
|
||||
if ( count( $this->getConfig()->get( 'AbuseFilterValidGroups' ) ) > 1 ) {
|
||||
$headers['af_group'] = 'abusefilter-list-group';
|
||||
}
|
||||
|
||||
|
@ -197,8 +196,7 @@ class AbuseFilterPager extends TablePager {
|
|||
$statuses[] = $this->msg( 'abusefilter-disabled' )->parse();
|
||||
}
|
||||
|
||||
global $wgAbuseFilterIsCentral;
|
||||
if ( $row->af_global && $wgAbuseFilterIsCentral ) {
|
||||
if ( $row->af_global && $this->getConfig()->get( 'AbuseFilterIsCentral' ) ) {
|
||||
$statuses[] = $this->msg( 'abusefilter-status-global' )->parse();
|
||||
}
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@ class GlobalAbuseFilterPager extends AbuseFilterPager {
|
|||
*/
|
||||
public function __construct( $page, $conds, $linkRenderer ) {
|
||||
parent::__construct( $page, $conds, $linkRenderer, [ '', 'LIKE' ] );
|
||||
global $wgAbuseFilterCentralDB;
|
||||
$this->mDb = wfGetDB( DB_REPLICA, [], $wgAbuseFilterCentralDB );
|
||||
$this->mDb = wfGetDB(
|
||||
DB_REPLICA, [], $this->getConfig()->get( 'AbuseFilterCentralDB' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -113,12 +113,10 @@ class SpecialAbuseLog extends SpecialPage {
|
|||
* Loads parameters from request
|
||||
*/
|
||||
public function loadParameters() {
|
||||
global $wgAbuseFilterIsCentral;
|
||||
|
||||
$request = $this->getRequest();
|
||||
|
||||
$this->mSearchUser = trim( $request->getText( 'wpSearchUser' ) );
|
||||
if ( $wgAbuseFilterIsCentral ) {
|
||||
if ( $this->getConfig()->get( 'AbuseFilterIsCentral' ) ) {
|
||||
$this->mSearchWiki = $request->getText( 'wpSearchWiki' );
|
||||
}
|
||||
|
||||
|
@ -148,11 +146,11 @@ class SpecialAbuseLog extends SpecialPage {
|
|||
* @return string[]
|
||||
*/
|
||||
private function getAllActions() {
|
||||
global $wgAbuseFilterActions, $wgAbuseFilterCustomActionsHandlers;
|
||||
$config = $this->getConfig();
|
||||
return array_unique(
|
||||
array_merge(
|
||||
array_keys( $wgAbuseFilterActions ),
|
||||
array_keys( $wgAbuseFilterCustomActionsHandlers )
|
||||
array_keys( $config->get( 'AbuseFilterActions' ) ),
|
||||
array_keys( $config->get( 'AbuseFilterCustomActionsHandlers' ) )
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -161,8 +159,6 @@ class SpecialAbuseLog extends SpecialPage {
|
|||
* Builds the search form
|
||||
*/
|
||||
public function searchForm() {
|
||||
global $wgAbuseFilterIsCentral;
|
||||
|
||||
$formDescriptor = [
|
||||
'SearchUser' => [
|
||||
'label-message' => 'abusefilter-log-search-user',
|
||||
|
@ -216,7 +212,7 @@ class SpecialAbuseLog extends SpecialPage {
|
|||
'default' => $this->mSearchFilter,
|
||||
];
|
||||
}
|
||||
if ( $wgAbuseFilterIsCentral ) {
|
||||
if ( $this->getConfig()->get( 'AbuseFilterIsCentral' ) ) {
|
||||
// Add free form input for wiki name. Would be nice to generate
|
||||
// a select with unique names in the db at some point.
|
||||
$formDescriptor['SearchWiki'] = [
|
||||
|
@ -549,8 +545,6 @@ class SpecialAbuseLog extends SpecialPage {
|
|||
* @return null
|
||||
*/
|
||||
public function showPrivateDetails( $id ) {
|
||||
global $wgAbuseFilterPrivateLog;
|
||||
|
||||
$lang = $this->getLanguage();
|
||||
$out = $this->getOutput();
|
||||
$request = $this->getRequest();
|
||||
|
@ -609,7 +603,7 @@ class SpecialAbuseLog extends SpecialPage {
|
|||
}
|
||||
|
||||
// Log accessing private details
|
||||
if ( $wgAbuseFilterPrivateLog ) {
|
||||
if ( $this->getConfig()->get( 'AbuseFilterPrivateLog' ) ) {
|
||||
$user = $this->getUser();
|
||||
self::addLogEntry( $id, $reason, $user );
|
||||
}
|
||||
|
@ -761,8 +755,7 @@ class SpecialAbuseLog extends SpecialPage {
|
|||
* @return bool
|
||||
*/
|
||||
protected function checkReason( $reason ) {
|
||||
global $wgAbuseFilterForceSummary;
|
||||
return ( !$wgAbuseFilterForceSummary || strlen( $reason ) > 0 );
|
||||
return ( !$this->getConfig()->get( 'AbuseFilterForceSummary' ) || strlen( $reason ) > 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -937,11 +930,10 @@ class SpecialAbuseLog extends SpecialPage {
|
|||
}
|
||||
|
||||
if ( $globalIndex ) {
|
||||
global $wgAbuseFilterCentralDB;
|
||||
$globalURL =
|
||||
WikiMap::getForeignURL( $wgAbuseFilterCentralDB,
|
||||
'Special:AbuseFilter/' . $globalIndex );
|
||||
|
||||
$globalURL = WikiMap::getForeignURL(
|
||||
$this->getConfig()->get( 'AbuseFilterCentralDB' ),
|
||||
'Special:AbuseFilter/' . $globalIndex
|
||||
);
|
||||
$linkText = $this->msg( 'abusefilter-log-detailedentry-global' )
|
||||
->numParams( $globalIndex )->escaped();
|
||||
$filterLink = Linker::makeExternalLink( $globalURL, $linkText );
|
||||
|
|
|
@ -20,11 +20,9 @@ class PurgeOldLogIPData extends Maintenance {
|
|||
* @see Maintenance:execute()
|
||||
*/
|
||||
public function execute() {
|
||||
global $wgAbuseFilterLogIPMaxAge;
|
||||
|
||||
$this->output( "Purging old IP Address data from abuse_filter_log...\n" );
|
||||
$dbw = wfGetDB( DB_MASTER );
|
||||
$cutoffUnix = time() - $wgAbuseFilterLogIPMaxAge;
|
||||
$cutoffUnix = time() - $this->getConfig()->get( 'AbuseFilterLogIPMaxAge' );
|
||||
|
||||
$count = 0;
|
||||
do {
|
||||
|
|
Loading…
Reference in a new issue