MediaWiki  master
MediaWiki\EditPage\Constraint\EditConstraintFactory Class Reference

Constraints reflect possible errors that need to be checked. More...

Collaboration diagram for MediaWiki\EditPage\Constraint\EditConstraintFactory:

Public Member Functions

 __construct (ServiceOptions $options, Spi $loggerFactory, PermissionManager $permissionManager, HookContainer $hookContainer, ReadOnlyMode $readOnlyMode, SpamChecker $spamRegexChecker)
 Some constraints have dependencies that need to be injected, this class serves as a factory for all of the different constraints that need dependencies injected. More...
 
 newEditFilterMergedContentHookConstraint (Content $content, IContextSource $context, string $summary, bool $minorEdit)
 
 newPageSizeConstraint (int $contentSize, string $type)
 
 newReadOnlyConstraint ()
 
 newSimpleAntiSpamConstraint (string $input, UserIdentity $user, Title $title)
 
 newSpamRegexConstraint (string $summary, string $section, string $sectionHeading, string $text, string $reqIP, Title $title)
 
 newUserBlockConstraint (LinkTarget $title, User $user)
 

Public Attributes

const CONSTRUCTOR_OPTIONS
 

Private Attributes

HookContainer $hookContainer
 
Spi $loggerFactory
 
ServiceOptions $options
 
PermissionManager $permissionManager
 
ReadOnlyMode $readOnlyMode
 
SpamChecker $spamRegexChecker
 

Detailed Description

Constraints reflect possible errors that need to be checked.

Since
1.36
Access: internal
Author
DannyS712

Definition at line 43 of file EditConstraintFactory.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\EditPage\Constraint\EditConstraintFactory::__construct ( ServiceOptions  $options,
Spi  $loggerFactory,
PermissionManager  $permissionManager,
HookContainer  $hookContainer,
ReadOnlyMode  $readOnlyMode,
SpamChecker  $spamRegexChecker 
)

Some constraints have dependencies that need to be injected, this class serves as a factory for all of the different constraints that need dependencies injected.

The checks in EditPage use wfDebugLog and logged to different channels, hence the need for multiple loggers retrieved from the Spi. The channels used are:

TODO can they be combined into the same channel?

Parameters
ServiceOptions$options
Spi$loggerFactory
PermissionManager$permissionManager
HookContainer$hookContainer
ReadOnlyMode$readOnlyMode
SpamChecker$spamRegexChecker

Definition at line 88 of file EditConstraintFactory.php.

References MediaWiki\EditPage\Constraint\EditConstraintFactory\$hookContainer, MediaWiki\EditPage\Constraint\EditConstraintFactory\$loggerFactory, MediaWiki\EditPage\Constraint\EditConstraintFactory\$options, MediaWiki\EditPage\Constraint\EditConstraintFactory\$permissionManager, MediaWiki\EditPage\Constraint\EditConstraintFactory\$readOnlyMode, MediaWiki\EditPage\Constraint\EditConstraintFactory\$spamRegexChecker, and MediaWiki\Config\ServiceOptions\assertRequiredOptions().

Member Function Documentation

◆ newEditFilterMergedContentHookConstraint()

MediaWiki\EditPage\Constraint\EditConstraintFactory::newEditFilterMergedContentHookConstraint ( Content  $content,
IContextSource  $context,
string  $summary,
bool  $minorEdit 
)
Parameters
Content$content
IContextSource$context
string$summary
bool$minorEdit
Returns
EditFilterMergedContentHookConstraint

Definition at line 122 of file EditConstraintFactory.php.

References $content, and MediaWiki\$context.

◆ newPageSizeConstraint()

MediaWiki\EditPage\Constraint\EditConstraintFactory::newPageSizeConstraint ( int  $contentSize,
string  $type 
)
Parameters
int$contentSize
string$type
Returns
PageSizeConstraint

Definition at line 142 of file EditConstraintFactory.php.

References $type.

◆ newReadOnlyConstraint()

MediaWiki\EditPage\Constraint\EditConstraintFactory::newReadOnlyConstraint ( )
Returns
ReadOnlyConstraint

Definition at line 156 of file EditConstraintFactory.php.

◆ newSimpleAntiSpamConstraint()

MediaWiki\EditPage\Constraint\EditConstraintFactory::newSimpleAntiSpamConstraint ( string  $input,
UserIdentity  $user,
Title  $title 
)
Parameters
string$input
UserIdentity$user
Title$title
Returns
SimpleAntiSpamConstraint

Definition at line 168 of file EditConstraintFactory.php.

References $title.

◆ newSpamRegexConstraint()

MediaWiki\EditPage\Constraint\EditConstraintFactory::newSpamRegexConstraint ( string  $summary,
string  $section,
string  $sectionHeading,
string  $text,
string  $reqIP,
Title  $title 
)
Parameters
string$summary
string$section
string$sectionHeading
string$text
string$reqIP
Title$title
Returns
SpamRegexConstraint

Definition at line 190 of file EditConstraintFactory.php.

References $title.

◆ newUserBlockConstraint()

MediaWiki\EditPage\Constraint\EditConstraintFactory::newUserBlockConstraint ( LinkTarget  $title,
User  $user 
)
Parameters
LinkTarget$title
User$user
Returns
UserBlockConstraint

Definition at line 215 of file EditConstraintFactory.php.

References $title.

Member Data Documentation

◆ $hookContainer

HookContainer MediaWiki\EditPage\Constraint\EditConstraintFactory::$hookContainer
private

◆ $loggerFactory

Spi MediaWiki\EditPage\Constraint\EditConstraintFactory::$loggerFactory
private

◆ $options

ServiceOptions MediaWiki\EditPage\Constraint\EditConstraintFactory::$options
private

◆ $permissionManager

PermissionManager MediaWiki\EditPage\Constraint\EditConstraintFactory::$permissionManager
private

◆ $readOnlyMode

ReadOnlyMode MediaWiki\EditPage\Constraint\EditConstraintFactory::$readOnlyMode
private

◆ $spamRegexChecker

SpamChecker MediaWiki\EditPage\Constraint\EditConstraintFactory::$spamRegexChecker
private

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\EditPage\Constraint\EditConstraintFactory::CONSTRUCTOR_OPTIONS
Initial value:
= [
'MaxArticleSize',
]
Access: internal

Definition at line 46 of file EditConstraintFactory.php.


The documentation for this class was generated from the following file: