2009-01-29 22:44:31 +00:00
|
|
|
<?php
|
|
|
|
|
2020-11-29 10:53:29 +00:00
|
|
|
namespace MediaWiki\Extension\AbuseFilter\View;
|
|
|
|
|
|
|
|
use ChangesList;
|
|
|
|
use HTMLForm;
|
|
|
|
use IContextSource;
|
2021-09-15 18:23:36 +00:00
|
|
|
use LogicException;
|
2021-01-03 11:12:16 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\AbuseFilterChangesList;
|
2020-10-23 14:19:02 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\AbuseFilterPermissionManager;
|
2021-01-19 13:54:18 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\CentralDBNotAvailableException;
|
2021-02-01 15:47:46 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\EditBox\EditBoxBuilderFactory;
|
2024-05-16 10:40:53 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\Filter\Flags;
|
2020-10-23 14:19:02 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\FilterLookup;
|
2020-12-03 14:11:19 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\Pager\AbuseFilterExaminePager;
|
2021-01-01 17:28:36 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\Special\SpecialAbuseLog;
|
2021-01-03 13:10:20 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\VariableGenerator\VariableGeneratorFactory;
|
2021-01-02 14:01:00 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\Variables\VariableHolder;
|
2021-01-02 13:41:31 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\Variables\VariablesBlobStore;
|
|
|
|
use MediaWiki\Extension\AbuseFilter\Variables\VariablesFormatter;
|
|
|
|
use MediaWiki\Extension\AbuseFilter\Variables\VariablesManager;
|
2024-03-29 12:40:23 +00:00
|
|
|
use MediaWiki\Html\Html;
|
2020-10-23 14:19:02 +00:00
|
|
|
use MediaWiki\Linker\LinkRenderer;
|
2020-01-08 16:46:24 +00:00
|
|
|
use MediaWiki\Revision\RevisionRecord;
|
2023-08-19 17:49:36 +00:00
|
|
|
use MediaWiki\Title\Title;
|
2020-11-29 10:53:29 +00:00
|
|
|
use OOUI;
|
|
|
|
use RecentChange;
|
2023-02-26 12:51:08 +00:00
|
|
|
use Wikimedia\Rdbms\LBFactory;
|
2020-01-08 13:33:10 +00:00
|
|
|
|
2009-01-29 22:44:31 +00:00
|
|
|
class AbuseFilterViewExamine extends AbuseFilterView {
|
2018-11-08 14:34:32 +00:00
|
|
|
/**
|
2021-04-03 14:08:17 +00:00
|
|
|
* @var string The rules of the filter we're examining
|
2018-11-08 14:34:32 +00:00
|
|
|
*/
|
2021-04-03 14:08:17 +00:00
|
|
|
private $testFilter;
|
2018-11-08 14:34:32 +00:00
|
|
|
/**
|
2023-02-26 12:51:08 +00:00
|
|
|
* @var LBFactory
|
2018-11-08 14:34:32 +00:00
|
|
|
*/
|
2023-02-26 12:51:08 +00:00
|
|
|
private $lbFactory;
|
2020-10-23 14:19:02 +00:00
|
|
|
/**
|
|
|
|
* @var FilterLookup
|
|
|
|
*/
|
|
|
|
private $filterLookup;
|
|
|
|
/**
|
|
|
|
* @var EditBoxBuilderFactory
|
|
|
|
*/
|
|
|
|
private $boxBuilderFactory;
|
2020-09-29 14:52:05 +00:00
|
|
|
/**
|
|
|
|
* @var VariablesBlobStore
|
|
|
|
*/
|
|
|
|
private $varBlobStore;
|
2020-12-31 13:29:00 +00:00
|
|
|
/**
|
|
|
|
* @var VariablesFormatter
|
|
|
|
*/
|
|
|
|
private $variablesFormatter;
|
2020-10-18 22:25:05 +00:00
|
|
|
/**
|
|
|
|
* @var VariablesManager
|
|
|
|
*/
|
|
|
|
private $varManager;
|
2021-01-03 13:10:20 +00:00
|
|
|
/**
|
|
|
|
* @var VariableGeneratorFactory
|
|
|
|
*/
|
|
|
|
private $varGeneratorFactory;
|
2020-10-23 14:19:02 +00:00
|
|
|
|
|
|
|
/**
|
2023-02-26 12:51:08 +00:00
|
|
|
* @param LBFactory $lbFactory
|
2020-10-23 14:19:02 +00:00
|
|
|
* @param AbuseFilterPermissionManager $afPermManager
|
|
|
|
* @param FilterLookup $filterLookup
|
|
|
|
* @param EditBoxBuilderFactory $boxBuilderFactory
|
2020-09-29 14:52:05 +00:00
|
|
|
* @param VariablesBlobStore $varBlobStore
|
2020-12-31 13:29:00 +00:00
|
|
|
* @param VariablesFormatter $variablesFormatter
|
2020-10-18 22:25:05 +00:00
|
|
|
* @param VariablesManager $varManager
|
2021-01-03 13:10:20 +00:00
|
|
|
* @param VariableGeneratorFactory $varGeneratorFactory
|
2020-10-23 14:19:02 +00:00
|
|
|
* @param IContextSource $context
|
|
|
|
* @param LinkRenderer $linkRenderer
|
|
|
|
* @param string $basePageName
|
|
|
|
* @param array $params
|
|
|
|
*/
|
|
|
|
public function __construct(
|
2023-02-26 12:51:08 +00:00
|
|
|
LBFactory $lbFactory,
|
2020-10-23 14:19:02 +00:00
|
|
|
AbuseFilterPermissionManager $afPermManager,
|
|
|
|
FilterLookup $filterLookup,
|
|
|
|
EditBoxBuilderFactory $boxBuilderFactory,
|
2020-09-29 14:52:05 +00:00
|
|
|
VariablesBlobStore $varBlobStore,
|
2020-12-31 13:29:00 +00:00
|
|
|
VariablesFormatter $variablesFormatter,
|
2020-10-18 22:25:05 +00:00
|
|
|
VariablesManager $varManager,
|
2021-01-03 13:10:20 +00:00
|
|
|
VariableGeneratorFactory $varGeneratorFactory,
|
2020-10-23 14:19:02 +00:00
|
|
|
IContextSource $context,
|
|
|
|
LinkRenderer $linkRenderer,
|
|
|
|
string $basePageName,
|
|
|
|
array $params
|
|
|
|
) {
|
|
|
|
parent::__construct( $afPermManager, $context, $linkRenderer, $basePageName, $params );
|
2023-02-26 12:51:08 +00:00
|
|
|
$this->lbFactory = $lbFactory;
|
2020-10-23 14:19:02 +00:00
|
|
|
$this->filterLookup = $filterLookup;
|
|
|
|
$this->boxBuilderFactory = $boxBuilderFactory;
|
2020-09-29 14:52:05 +00:00
|
|
|
$this->varBlobStore = $varBlobStore;
|
2020-12-31 13:29:00 +00:00
|
|
|
$this->variablesFormatter = $variablesFormatter;
|
|
|
|
$this->variablesFormatter->setMessageLocalizer( $context );
|
2020-10-18 22:25:05 +00:00
|
|
|
$this->varManager = $varManager;
|
2021-01-03 13:10:20 +00:00
|
|
|
$this->varGeneratorFactory = $varGeneratorFactory;
|
2020-10-23 14:19:02 +00:00
|
|
|
}
|
2013-10-15 13:22:05 +00:00
|
|
|
|
2018-04-04 21:14:25 +00:00
|
|
|
/**
|
|
|
|
* Shows the page
|
|
|
|
*/
|
|
|
|
public function show() {
|
2011-11-16 05:34:24 +00:00
|
|
|
$out = $this->getOutput();
|
2023-09-22 20:43:01 +00:00
|
|
|
$out->setPageTitleMsg( $this->msg( 'abusefilter-examine' ) );
|
2020-10-03 13:05:20 +00:00
|
|
|
$out->addHelpLink( 'Extension:AbuseFilter/Rules format' );
|
2022-07-02 13:35:00 +00:00
|
|
|
if ( $this->afPermManager->canUseTestTools( $this->getAuthority() ) ) {
|
2021-02-19 18:11:20 +00:00
|
|
|
$out->addWikiMsg( 'abusefilter-examine-intro' );
|
|
|
|
} else {
|
|
|
|
$out->addWikiMsg( 'abusefilter-examine-intro-examine-only' );
|
|
|
|
}
|
2009-01-29 22:44:31 +00:00
|
|
|
|
2021-04-03 14:08:17 +00:00
|
|
|
$this->testFilter = $this->getRequest()->getText( 'testfilter' );
|
2009-01-29 22:44:31 +00:00
|
|
|
|
|
|
|
// Check if we've got a subpage
|
2009-10-07 13:57:06 +00:00
|
|
|
if ( count( $this->mParams ) > 1 && is_numeric( $this->mParams[1] ) ) {
|
2009-02-04 19:51:03 +00:00
|
|
|
$this->showExaminerForRC( $this->mParams[1] );
|
2009-10-07 13:57:06 +00:00
|
|
|
} elseif ( count( $this->mParams ) > 2
|
2018-08-26 08:34:42 +00:00
|
|
|
&& $this->mParams[1] === 'log'
|
2017-07-08 18:49:13 +00:00
|
|
|
&& is_numeric( $this->mParams[2] )
|
|
|
|
) {
|
2009-02-04 19:51:03 +00:00
|
|
|
$this->showExaminerForLogEntry( $this->mParams[2] );
|
2009-01-29 22:44:31 +00:00
|
|
|
} else {
|
|
|
|
$this->showSearch();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-04 21:14:25 +00:00
|
|
|
/**
|
|
|
|
* Shows the search form
|
|
|
|
*/
|
|
|
|
public function showSearch() {
|
2018-03-09 11:27:18 +00:00
|
|
|
$RCMaxAge = $this->getConfig()->get( 'RCMaxAge' );
|
|
|
|
$min = wfTimestamp( TS_ISO_8601, time() - $RCMaxAge );
|
|
|
|
$max = wfTimestampNow();
|
2017-06-15 14:23:16 +00:00
|
|
|
$formDescriptor = [
|
|
|
|
'SearchUser' => [
|
2016-04-10 13:12:43 +00:00
|
|
|
'label-message' => 'abusefilter-test-user',
|
|
|
|
'type' => 'user',
|
2018-04-05 10:23:57 +00:00
|
|
|
'ipallowed' => true,
|
2017-06-15 14:23:16 +00:00
|
|
|
],
|
|
|
|
'SearchPeriodStart' => [
|
2016-04-10 13:12:43 +00:00
|
|
|
'label-message' => 'abusefilter-test-period-start',
|
2018-03-09 11:27:18 +00:00
|
|
|
'type' => 'datetime',
|
|
|
|
'min' => $min,
|
|
|
|
'max' => $max,
|
2017-06-15 14:23:16 +00:00
|
|
|
],
|
|
|
|
'SearchPeriodEnd' => [
|
2016-04-10 13:12:43 +00:00
|
|
|
'label-message' => 'abusefilter-test-period-end',
|
2018-03-09 11:27:18 +00:00
|
|
|
'type' => 'datetime',
|
|
|
|
'min' => $min,
|
|
|
|
'max' => $max,
|
2017-06-15 14:23:16 +00:00
|
|
|
],
|
|
|
|
];
|
2021-04-03 14:08:17 +00:00
|
|
|
HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() )
|
|
|
|
->addHiddenField( 'testfilter', $this->testFilter )
|
|
|
|
->setWrapperLegendMsg( 'abusefilter-examine-legend' )
|
2016-04-10 13:12:43 +00:00
|
|
|
->setSubmitTextMsg( 'abusefilter-examine-submit' )
|
2020-10-04 12:38:18 +00:00
|
|
|
->setSubmitCallback( [ $this, 'showResults' ] )
|
|
|
|
->showAlways();
|
2009-01-29 22:44:31 +00:00
|
|
|
}
|
|
|
|
|
2018-04-04 21:14:25 +00:00
|
|
|
/**
|
2020-10-04 12:38:18 +00:00
|
|
|
* Show search results, called as submit callback by HTMLForm
|
|
|
|
* @param array $formData
|
|
|
|
* @param HTMLForm $form
|
|
|
|
* @return bool
|
2018-04-04 21:14:25 +00:00
|
|
|
*/
|
2021-07-21 18:51:12 +00:00
|
|
|
public function showResults( array $formData, HTMLForm $form ): bool {
|
2021-04-03 14:08:17 +00:00
|
|
|
$changesList = new AbuseFilterChangesList( $this->getContext(), $this->testFilter );
|
|
|
|
|
2023-02-26 12:51:08 +00:00
|
|
|
$dbr = $this->lbFactory->getReplicaDatabase();
|
2021-04-03 14:08:17 +00:00
|
|
|
$conds = $this->buildVisibilityConditions( $dbr, $this->getAuthority() );
|
|
|
|
$conds[] = $this->buildTestConditions( $dbr );
|
|
|
|
|
|
|
|
// Normalise username
|
|
|
|
$userTitle = Title::newFromText( $formData['SearchUser'], NS_USER );
|
|
|
|
$userName = $userTitle ? $userTitle->getText() : '';
|
|
|
|
|
|
|
|
if ( $userName !== '' ) {
|
|
|
|
$rcQuery = RecentChange::getQueryInfo();
|
|
|
|
$conds[$rcQuery['fields']['rc_user_text']] = $userName;
|
|
|
|
}
|
|
|
|
|
|
|
|
$startTS = strtotime( $formData['SearchPeriodStart'] );
|
|
|
|
if ( $startTS ) {
|
2024-05-30 09:09:56 +00:00
|
|
|
$conds[] = $dbr->expr( 'rc_timestamp', '>=', $dbr->timestamp( $startTS ) );
|
2021-04-03 14:08:17 +00:00
|
|
|
}
|
|
|
|
$endTS = strtotime( $formData['SearchPeriodEnd'] );
|
|
|
|
if ( $endTS ) {
|
2024-05-30 09:09:56 +00:00
|
|
|
$conds[] = $dbr->expr( 'rc_timestamp', '<=', $dbr->timestamp( $endTS ) );
|
2021-04-03 14:08:17 +00:00
|
|
|
}
|
|
|
|
$pager = new AbuseFilterExaminePager(
|
|
|
|
$changesList,
|
|
|
|
$this->linkRenderer,
|
|
|
|
$dbr,
|
|
|
|
$this->getTitle( 'examine' ),
|
|
|
|
$conds
|
|
|
|
);
|
2009-10-07 13:57:06 +00:00
|
|
|
|
2020-10-31 14:27:20 +00:00
|
|
|
$output = $changesList->beginRecentChangesList()
|
|
|
|
. $pager->getNavigationBar()
|
|
|
|
. $pager->getBody()
|
|
|
|
. $pager->getNavigationBar()
|
|
|
|
. $changesList->endRecentChangesList();
|
2009-01-29 22:44:31 +00:00
|
|
|
|
2022-05-24 07:31:17 +00:00
|
|
|
$form->addPostHtml( $output );
|
2020-10-04 12:38:18 +00:00
|
|
|
return true;
|
2009-01-29 22:44:31 +00:00
|
|
|
}
|
|
|
|
|
2018-04-04 21:14:25 +00:00
|
|
|
/**
|
|
|
|
* @param int $rcid
|
|
|
|
*/
|
|
|
|
public function showExaminerForRC( $rcid ) {
|
2009-01-29 22:44:31 +00:00
|
|
|
// Get data
|
2020-05-28 18:09:17 +00:00
|
|
|
$rc = RecentChange::newFromId( $rcid );
|
2014-07-29 23:46:29 +00:00
|
|
|
$out = $this->getOutput();
|
2020-05-28 18:09:17 +00:00
|
|
|
if ( !$rc ) {
|
2014-07-29 23:46:29 +00:00
|
|
|
$out->addWikiMsg( 'abusefilter-examine-notfound' );
|
2009-01-29 22:44:31 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-05-28 18:09:17 +00:00
|
|
|
if ( !ChangesList::userCan( $rc, RevisionRecord::SUPPRESSED_ALL ) ) {
|
2018-10-16 21:04:20 +00:00
|
|
|
$out->addWikiMsg( 'abusefilter-log-details-hidden-implicit' );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-01-03 13:10:20 +00:00
|
|
|
$varGenerator = $this->varGeneratorFactory->newRCGenerator( $rc, $this->getUser() );
|
2021-01-02 14:01:00 +00:00
|
|
|
$vars = $varGenerator->getVars() ?: new VariableHolder();
|
2018-12-08 14:20:34 +00:00
|
|
|
$out->addJsConfigVars( [
|
2020-10-18 22:25:05 +00:00
|
|
|
'wgAbuseFilterVariables' => $this->varManager->dumpAllVars( $vars, true ),
|
2018-12-08 14:20:34 +00:00
|
|
|
'abuseFilterExamine' => [ 'type' => 'rc', 'id' => $rcid ]
|
|
|
|
] );
|
|
|
|
|
2009-02-04 19:51:03 +00:00
|
|
|
$this->showExaminer( $vars );
|
|
|
|
}
|
|
|
|
|
2018-04-04 21:14:25 +00:00
|
|
|
/**
|
|
|
|
* @param int $logid
|
|
|
|
*/
|
|
|
|
public function showExaminerForLogEntry( $logid ) {
|
2009-02-04 19:51:03 +00:00
|
|
|
// Get data
|
2023-02-26 12:51:08 +00:00
|
|
|
$dbr = $this->lbFactory->getReplicaDatabase();
|
2022-07-02 13:35:00 +00:00
|
|
|
$performer = $this->getAuthority();
|
2019-08-27 09:40:01 +00:00
|
|
|
$out = $this->getOutput();
|
|
|
|
|
2024-04-30 18:21:20 +00:00
|
|
|
$row = $dbr->newSelectQueryBuilder()
|
|
|
|
->select( [
|
2019-02-06 16:07:01 +00:00
|
|
|
'afl_deleted',
|
2024-03-22 13:40:06 +00:00
|
|
|
'afl_ip',
|
2019-02-06 16:07:01 +00:00
|
|
|
'afl_var_dump',
|
|
|
|
'afl_rev_id',
|
|
|
|
'afl_filter_id',
|
|
|
|
'afl_global'
|
2024-04-30 18:21:20 +00:00
|
|
|
] )
|
|
|
|
->from( 'abuse_filter_log' )
|
|
|
|
->where( [ 'afl_id' => $logid ] )
|
|
|
|
->caller( __METHOD__ )
|
|
|
|
->fetchRow();
|
2009-02-04 19:51:03 +00:00
|
|
|
|
2009-10-07 13:57:06 +00:00
|
|
|
if ( !$row ) {
|
2014-07-29 23:46:29 +00:00
|
|
|
$out->addWikiMsg( 'abusefilter-examine-notfound' );
|
2009-02-04 19:51:03 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-01-19 13:54:18 +00:00
|
|
|
try {
|
2024-05-16 10:40:53 +00:00
|
|
|
$privacyLevel = $this->filterLookup->getFilter( $row->afl_filter_id, $row->afl_global )->getPrivacyLevel();
|
2021-01-19 13:54:18 +00:00
|
|
|
} catch ( CentralDBNotAvailableException $_ ) {
|
2024-05-23 14:49:17 +00:00
|
|
|
// Conservatively assume that it's hidden and protected, like in SpecialAbuseLog
|
|
|
|
$privacyLevel = Flags::FILTER_HIDDEN & Flags::FILTER_USES_PROTECTED_VARS;
|
2021-01-19 13:54:18 +00:00
|
|
|
}
|
2024-05-16 10:40:53 +00:00
|
|
|
if ( !$this->afPermManager->canSeeLogDetailsForFilter( $performer, $privacyLevel ) ) {
|
2014-07-29 23:46:29 +00:00
|
|
|
$out->addWikiMsg( 'abusefilter-log-cannot-see-details' );
|
2011-12-27 23:35:24 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-07-02 13:35:00 +00:00
|
|
|
$visibility = SpecialAbuseLog::getEntryVisibilityForUser( $row, $performer, $this->afPermManager );
|
2021-09-15 18:23:36 +00:00
|
|
|
if ( $visibility !== SpecialAbuseLog::VISIBILITY_VISIBLE ) {
|
|
|
|
if ( $visibility === SpecialAbuseLog::VISIBILITY_HIDDEN ) {
|
|
|
|
$msg = 'abusefilter-log-details-hidden';
|
|
|
|
} elseif ( $visibility === SpecialAbuseLog::VISIBILITY_HIDDEN_IMPLICIT ) {
|
|
|
|
$msg = 'abusefilter-log-details-hidden-implicit';
|
|
|
|
} else {
|
|
|
|
throw new LogicException( "Unexpected visibility $visibility" );
|
|
|
|
}
|
|
|
|
$out->addWikiMsg( $msg );
|
2011-12-27 23:35:24 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2024-03-22 13:40:06 +00:00
|
|
|
$vars = $this->varBlobStore->loadVarDump( $row );
|
|
|
|
|
2018-12-08 14:20:34 +00:00
|
|
|
$out->addJsConfigVars( [
|
2020-10-18 22:25:05 +00:00
|
|
|
'wgAbuseFilterVariables' => $this->varManager->dumpAllVars( $vars, true ),
|
2018-12-08 14:20:34 +00:00
|
|
|
'abuseFilterExamine' => [ 'type' => 'log', 'id' => $logid ]
|
|
|
|
] );
|
2009-02-04 19:51:03 +00:00
|
|
|
$this->showExaminer( $vars );
|
|
|
|
}
|
|
|
|
|
2018-04-04 21:14:25 +00:00
|
|
|
/**
|
2021-01-02 14:01:00 +00:00
|
|
|
* @param VariableHolder|null $vars
|
2018-04-04 21:14:25 +00:00
|
|
|
*/
|
2021-01-02 14:01:00 +00:00
|
|
|
public function showExaminer( ?VariableHolder $vars ) {
|
2011-11-16 05:34:24 +00:00
|
|
|
$output = $this->getOutput();
|
2018-03-15 17:22:37 +00:00
|
|
|
$output->enableOOUI();
|
2009-02-04 19:51:03 +00:00
|
|
|
|
2009-10-07 13:57:06 +00:00
|
|
|
if ( !$vars ) {
|
2011-11-16 05:34:24 +00:00
|
|
|
$output->addWikiMsg( 'abusefilter-examine-incompatible' );
|
2009-01-29 22:44:31 +00:00
|
|
|
return;
|
|
|
|
}
|
2009-10-07 13:57:06 +00:00
|
|
|
|
2011-11-22 16:08:18 +00:00
|
|
|
$html = '';
|
2009-01-29 22:44:31 +00:00
|
|
|
|
2011-11-16 05:34:24 +00:00
|
|
|
$output->addModules( 'ext.abuseFilter.examine' );
|
2009-01-29 22:44:31 +00:00
|
|
|
|
|
|
|
// Add test bit
|
2022-07-02 13:35:00 +00:00
|
|
|
if ( $this->afPermManager->canUseTestTools( $this->getAuthority() ) ) {
|
2020-10-23 14:19:02 +00:00
|
|
|
$boxBuilder = $this->boxBuilderFactory->newEditBoxBuilder(
|
2020-11-24 12:16:41 +00:00
|
|
|
$this,
|
2022-07-02 13:35:00 +00:00
|
|
|
$this->getAuthority(),
|
2020-11-24 12:16:41 +00:00
|
|
|
$output
|
|
|
|
);
|
|
|
|
|
2024-03-29 12:40:23 +00:00
|
|
|
$tester = Html::rawElement( 'h2', [], $this->msg( 'abusefilter-examine-test' )->parse() );
|
2021-04-03 14:08:17 +00:00
|
|
|
$tester .= $boxBuilder->buildEditBox( $this->testFilter, false, false, false );
|
2018-12-09 13:33:30 +00:00
|
|
|
$tester .= $this->buildFilterLoader();
|
2024-03-29 12:40:23 +00:00
|
|
|
$html .= Html::rawElement( 'div', [ 'id' => 'mw-abusefilter-examine-editor' ], $tester );
|
|
|
|
$html .= Html::rawElement( 'p',
|
|
|
|
[],
|
2018-03-15 17:22:37 +00:00
|
|
|
new OOUI\ButtonInputWidget(
|
2017-06-15 14:23:16 +00:00
|
|
|
[
|
2018-03-15 17:22:37 +00:00
|
|
|
'label' => $this->msg( 'abusefilter-examine-test-button' )->text(),
|
2021-02-01 14:50:06 +00:00
|
|
|
'id' => 'mw-abusefilter-examine-test',
|
|
|
|
'flags' => [ 'primary', 'progressive' ]
|
2017-06-15 14:23:16 +00:00
|
|
|
]
|
2009-03-31 15:13:26 +00:00
|
|
|
) .
|
2024-03-29 12:40:23 +00:00
|
|
|
Html::element( 'div',
|
2017-06-15 14:23:16 +00:00
|
|
|
[
|
2009-10-07 13:57:06 +00:00
|
|
|
'id' => 'mw-abusefilter-syntaxresult',
|
|
|
|
'style' => 'display: none;'
|
2024-05-13 11:15:27 +00:00
|
|
|
]
|
2009-10-07 13:57:06 +00:00
|
|
|
)
|
2009-02-07 09:34:11 +00:00
|
|
|
);
|
2009-03-31 15:13:26 +00:00
|
|
|
}
|
2009-01-29 22:44:31 +00:00
|
|
|
|
|
|
|
// Variable dump
|
2024-03-29 12:40:23 +00:00
|
|
|
$html .= Html::rawElement(
|
2012-09-02 11:07:02 +00:00
|
|
|
'h2',
|
2024-03-29 12:40:23 +00:00
|
|
|
[],
|
2017-08-20 12:48:51 +00:00
|
|
|
$this->msg( 'abusefilter-examine-vars' )->parse()
|
2012-09-02 11:07:02 +00:00
|
|
|
);
|
2020-12-31 13:29:00 +00:00
|
|
|
$html .= $this->variablesFormatter->buildVarDumpTable( $vars );
|
2009-01-29 22:44:31 +00:00
|
|
|
|
2011-11-22 16:08:18 +00:00
|
|
|
$output->addHTML( $html );
|
2009-01-29 22:44:31 +00:00
|
|
|
}
|
|
|
|
|
2009-02-07 09:34:11 +00:00
|
|
|
}
|