MediaWiki master
MediaWiki\EditPage\Constraint\EditConstraintFactory Class Reference

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

Public Member Functions

 __construct (private readonly ServiceOptions $options, private readonly Spi $loggerFactory, private readonly HookContainer $hookContainer, private readonly ReadOnlyMode $readOnlyMode, private readonly SpamChecker $spamRegexChecker, private readonly RateLimiter $rateLimiter, private readonly RedirectLookup $redirectLookup, private readonly IConnectionProvider $connectionProvider, private readonly LogFormatterFactory $logFormatterFactory,)
 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.
 
 newAccidentalRecreationConstraint (Title $title, bool $allowRecreation, ?string $startTime, ?string $submitButtonLabel=null,)
 
 newEditFilterMergedContentHookConstraint (Content $content, IContextSource $context, string $summary, bool $minorEdit, Language $language, User $user)
 
 newLinkPurgeRateLimitConstraint (RateLimitSubject $subject)
 
 newPageSizeConstraint (int $contentSize, string $type)
 
 newReadOnlyConstraint ()
 
 newRedirectConstraint (?Title $allowedProblematicRedirectTarget, Content $newContent, ?Content $originalContent, LinkTarget $title, MessageValue $errorMessageWrapper, ?string $contentFormat,)
 
 newSimpleAntiSpamConstraint (string $input, UserIdentity $user, Title $title)
 
 newSpamRegexConstraint (string $summary, ?string $sectionHeading, string $text, string $reqIP, Title $title)
 

Public Attributes

const CONSTRUCTOR_OPTIONS
 

Detailed Description

Constraints reflect possible errors that need to be checked.

Since
1.36
Access: internal
Author
DannyS712

Definition at line 36 of file EditConstraintFactory.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\EditPage\Constraint\EditConstraintFactory::__construct ( private readonly ServiceOptions $options,
private readonly Spi $loggerFactory,
private readonly HookContainer $hookContainer,
private readonly ReadOnlyMode $readOnlyMode,
private readonly SpamChecker $spamRegexChecker,
private readonly RateLimiter $rateLimiter,
private readonly RedirectLookup $redirectLookup,
private readonly IConnectionProvider $connectionProvider,
private readonly LogFormatterFactory $logFormatterFactory )

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:

  • SimpleAntiSpam (in SimpleAntiSpamConstraint)
  • SpamRegex (in SpamRegexConstraint)

TODO can they be combined into the same channel?

Definition at line 56 of file EditConstraintFactory.php.

Member Function Documentation

◆ newAccidentalRecreationConstraint()

MediaWiki\EditPage\Constraint\EditConstraintFactory::newAccidentalRecreationConstraint ( Title $title,
bool $allowRecreation,
?string $startTime,
?string $submitButtonLabel = null )

Definition at line 205 of file EditConstraintFactory.php.

◆ newEditFilterMergedContentHookConstraint()

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

Definition at line 86 of file EditConstraintFactory.php.

◆ newLinkPurgeRateLimitConstraint()

MediaWiki\EditPage\Constraint\EditConstraintFactory::newLinkPurgeRateLimitConstraint ( RateLimitSubject $subject)
Parameters
RateLimitSubject$subject
Returns
LinkPurgeRateLimitConstraint

Definition at line 132 of file EditConstraintFactory.php.

◆ newPageSizeConstraint()

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

Definition at line 110 of file EditConstraintFactory.php.

◆ newReadOnlyConstraint()

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

Definition at line 121 of file EditConstraintFactory.php.

◆ newRedirectConstraint()

MediaWiki\EditPage\Constraint\EditConstraintFactory::newRedirectConstraint ( ?Title $allowedProblematicRedirectTarget,
Content $newContent,
?Content $originalContent,
LinkTarget $title,
MessageValue $errorMessageWrapper,
?string $contentFormat )

◆ newSimpleAntiSpamConstraint()

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

Definition at line 147 of file EditConstraintFactory.php.

◆ newSpamRegexConstraint()

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

Definition at line 168 of file EditConstraintFactory.php.

Member Data Documentation

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\EditPage\Constraint\EditConstraintFactory::CONSTRUCTOR_OPTIONS
Initial value:
= [
]
const MaxArticleSize
Name constant for the MaxArticleSize setting, for use with Config::get()
Access: internal

Definition at line 39 of file EditConstraintFactory.php.


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