Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 12 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| EditorCapability | |
0.00% |
0 / 12 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| execute | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Extension\AbuseFilter\BlockedDomains; |
| 4 | |
| 5 | use LogicException; |
| 6 | use MediaWiki\Context\IContextSource; |
| 7 | use MediaWiki\Extension\CommunityConfiguration\EditorCapabilities\AbstractEditorCapability; |
| 8 | use MediaWiki\Extension\CommunityConfiguration\Provider\IConfigurationProvider; |
| 9 | use MediaWiki\Linker\LinkRenderer; |
| 10 | use MediaWiki\Title\Title; |
| 11 | use Wikimedia\ObjectCache\WANObjectCache; |
| 12 | |
| 13 | class EditorCapability extends AbstractEditorCapability { |
| 14 | |
| 15 | public function __construct( |
| 16 | IContextSource $ctx, |
| 17 | Title $parentTitle, |
| 18 | private readonly WANObjectCache $wanCache, |
| 19 | private readonly LinkRenderer $linkRenderer, |
| 20 | private readonly BlockedDomainValidator $blockedDomainValidator |
| 21 | ) { |
| 22 | parent::__construct( $ctx, $parentTitle ); |
| 23 | } |
| 24 | |
| 25 | /** |
| 26 | * @inheritDoc |
| 27 | */ |
| 28 | public function execute( ?IConfigurationProvider $provider, ?string $subpage = null ): void { |
| 29 | if ( !$provider instanceof BlockedDomainConfigProvider ) { |
| 30 | throw new LogicException( __CLASS__ . ' received unsupported provider' ); |
| 31 | } |
| 32 | |
| 33 | $this->getContext()->getOutput()->addSubtitle( '< ' . $this->linkRenderer->makeLink( |
| 34 | $this->getParentTitle() |
| 35 | ) ); |
| 36 | $editor = new BlockedDomainEditor( |
| 37 | $this->getContext(), $this->getParentTitle()->getSubpage( $provider->getId() ), |
| 38 | $this->wanCache, $this->linkRenderer, |
| 39 | $provider, $this->blockedDomainValidator |
| 40 | ); |
| 41 | $editor->execute( $subpage ); |
| 42 | } |
| 43 | } |