Merge "Remove AbuseFilter::getFilter"

This commit is contained in:
jenkins-bot 2020-11-20 06:46:01 +00:00 committed by Gerrit Code Review
commit b6b90c07cb
4 changed files with 9 additions and 18 deletions

View file

@ -268,17 +268,6 @@ class AbuseFilter {
return $runner->run();
}
/**
* @deprecated since 1.36 Use FilterLookup
* @param string $filter Filter ID (integer or "<GLOBAL_FILTER_PREFIX><integer>")
* @return stdClass DB row
*/
public static function getFilter( $filter ) {
[ $filterID, $global ] = self::splitGlobalName( $filter );
$lookup = AbuseFilterServices::getFilterLookup();
return $lookup->getFilter( $filterID, $global )->toDatabaseRow();
}
/**
* Store a var dump to External Storage or the text table
* Some of this code is stolen from Revision::insertOn and friends

View file

@ -159,7 +159,8 @@ class AbuseFilterViewExamine extends AbuseFilterView {
return;
}
$isHidden = AbuseFilter::getFilter( $row->afl_filter )->af_hidden;
[ $filterID, $isGlobal ] = AbuseFilter::splitGlobalName( $row->afl_filter );
$isHidden = AbuseFilterServices::getFilterLookup()->getFilter( $filterID, $isGlobal )->isHidden();
if ( !$afPermManager->canSeeLogDetailsForFilter( $user, $isHidden ) ) {
$out->addWikiMsg( 'abusefilter-log-cannot-see-details' );
return;

View file

@ -186,7 +186,7 @@ class ApiQueryAbuseLog extends ApiQueryBase {
}
}
list( $filterID, $global ) = AbuseFilter::splitGlobalName( $row->afl_filter );
$isHidden = AbuseFilter::getFilter( $row->afl_filter )->af_hidden;
$isHidden = $lookup->getFilter( $filterID, $global )->isHidden();
$canSeeDetails = $afPermManager->canSeeLogDetailsForFilter( $user, $isHidden );
$entry = [];

View file

@ -678,9 +678,9 @@ class SpecialAbuseLog extends AbuseFilterSpecialPage {
if ( !$row ) {
$error = 'abusefilter-log-nonexistent';
} else {
list( , $global ) = AbuseFilter::splitGlobalName( $row->afl_filter );
list( $filterID, $global ) = AbuseFilter::splitGlobalName( $row->afl_filter );
if ( $global ) {
$filter_hidden = AbuseFilter::getFilter( $row->afl_filter )->af_hidden;
$filter_hidden = AbuseFilterServices::getFilterLookup()->getFilter( $filterID, $global )->isHidden();
} else {
$filter_hidden = $row->af_hidden;
}
@ -840,9 +840,10 @@ class SpecialAbuseLog extends AbuseFilterSpecialPage {
return $status;
}
list( , $global ) = AbuseFilter::splitGlobalName( $row->afl_filter );
list( $filterID, $global ) = AbuseFilter::splitGlobalName( $row->afl_filter );
if ( $global ) {
$filterHidden = AbuseFilter::getFilter( $row->afl_filter )->af_hidden;
$lookup = AbuseFilterServices::getFilterLookup();
$filterHidden = $lookup->getFilter( $filterID, $global )->isHidden();
} else {
$filterHidden = $row->af_hidden;
}
@ -1184,7 +1185,7 @@ class SpecialAbuseLog extends AbuseFilterSpecialPage {
} catch ( CentralDBNotAvailableException $_ ) {
$escaped_comments = $this->msg( 'abusefilter-log-description-not-available' )->escaped();
}
$filter_hidden = AbuseFilter::getFilter( $row->afl_filter )->af_hidden;
$filter_hidden = $lookup->getFilter( $filterID, $global )->isHidden();
} else {
$escaped_comments = Sanitizer::escapeHtmlAllowEntities(
$row->af_public_comments );