MediaWiki  master
MediaWiki\EditPage\Constraint\EditFilterMergedContentHookConstraint Class Reference

Verify EditFilterMergedContent hook. More...

Inheritance diagram for MediaWiki\EditPage\Constraint\EditFilterMergedContentHookConstraint:
Collaboration diagram for MediaWiki\EditPage\Constraint\EditFilterMergedContentHookConstraint:

Public Member Functions

 __construct (HookContainer $hookContainer, Content $content, IContextSource $hookContext, string $summary, bool $minorEdit, Language $language, User $hookUser)
 
 checkConstraint ()
 
 getHookError ()
 TODO this is really ugly. More...
 
 getLegacyStatus ()
 Get the legacy status for failure (or success) More...
 

Private Member Functions

 formatStatusErrors (Status $status)
 Wrap status errors in error boxes for increased visibility. More...
 

Private Attributes

Content $content
 
IContextSource $hookContext
 
string $hookError = ''
 
HookRunner $hookRunner
 
User $hookUser
 
Language $language
 
bool $minorEdit
 
Status $status
 
string $summary
 

Additional Inherited Members

- Public Attributes inherited from MediaWiki\EditPage\IEditObject
const AS_ARTICLE_WAS_DELETED = 222
 Status: article was deleted while editing and wpRecreate == false or form was not posted. More...
 
const AS_BLANK_ARTICLE = 224
 Status: user tried to create a blank page and wpIgnoreBlankArticle == false. More...
 
const AS_BLOCKED_PAGE_FOR_USER = 215
 Status: User is blocked from editing this page. More...
 
const AS_CHANGE_TAG_ERROR = 237
 Status: an error relating to change tagging. More...
 
const AS_CONFLICT_DETECTED = 225
 Status: (non-resolvable) edit conflict. More...
 
const AS_CONTENT_TOO_BIG = 216
 Status: Content too big (> $wgMaxArticleSize) More...
 
const AS_END = 231
 Status: WikiPage::doEdit() was unsuccessful. More...
 
const AS_HOOK_ERROR = 210
 Status: Article update aborted by a hook function. More...
 
const AS_HOOK_ERROR_EXPECTED = 212
 Status: A hook function returned an error. More...
 
const AS_IMAGE_REDIRECT_ANON = 233
 Status: anonymous user is not allowed to upload (User::isAllowed('upload') == false) More...
 
const AS_IMAGE_REDIRECT_LOGGED = 234
 Status: logged in user is not allowed to upload (User::isAllowed('upload') == false) More...
 
const AS_MAX_ARTICLE_SIZE_EXCEEDED = 229
 Status: article is too big (> $wgMaxArticleSize), after merging in the new section. More...
 
const AS_NO_CHANGE_CONTENT_MODEL = 235
 Status: user tried to modify the content model, but is not allowed to do that ( User::isAllowed('editcontentmodel') == false ) More...
 
const AS_NO_CREATE_PERMISSION = 223
 Status: user tried to create this page, but is not allowed to do that. More...
 
const AS_PARSE_ERROR = 240
 Status: can't parse content. More...
 
const AS_RATE_LIMITED = 221
 Status: rate limiter for action 'edit' was tripped. More...
 
const AS_READ_ONLY_PAGE = 220
 Status: wiki is in readonly mode (wfReadOnly() == true) More...
 
const AS_READ_ONLY_PAGE_ANON = 218
 Status: this anonymous user is not allowed to edit this page. More...
 
const AS_READ_ONLY_PAGE_LOGGED = 219
 Status: this logged in user is not allowed to edit this page. More...
 
const AS_SELF_REDIRECT = 236
 Status: user tried to create self-redirect and wpIgnoreSelfRedirect is false. More...
 
const AS_SPAM_ERROR = 232
 Status: summary contained spam according to one of the regexes in $wgSummarySpamRegex. More...
 
const AS_SUCCESS_NEW_ARTICLE = 201
 Status: Article successfully created. More...
 
const AS_SUCCESS_UPDATE = 200
 Status: Article successfully updated. More...
 
const AS_SUMMARY_NEEDED = 226
 Status: no edit summary given and the user has forceeditsummary set and the user is not editing in his own userspace or talkspace and wpIgnoreBlankSummary == false. More...
 
const AS_TEXTBOX_EMPTY = 228
 Status: user tried to create a new section without content. More...
 
const AS_UNICODE_NOT_SUPPORTED = 242
 Status: edit rejected because browser doesn't support Unicode. More...
 

Detailed Description

Verify EditFilterMergedContent hook.

Since
1.36
Author
DannyS712
Access: internal

Definition at line 42 of file EditFilterMergedContentHookConstraint.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\EditPage\Constraint\EditFilterMergedContentHookConstraint::__construct ( HookContainer  $hookContainer,
Content  $content,
IContextSource  $hookContext,
string  $summary,
bool  $minorEdit,
Language  $language,
User  $hookUser 
)

Member Function Documentation

◆ checkConstraint()

MediaWiki\EditPage\Constraint\EditFilterMergedContentHookConstraint::checkConstraint ( )
Returns
string whether the constraint passed, either CONSTRAINT_PASSED or CONSTRAINT_FAILED

Implements MediaWiki\EditPage\Constraint\IEditConstraint.

Definition at line 99 of file EditFilterMergedContentHookConstraint.php.

References MediaWiki\EditPage\IEditObject\AS_HOOK_ERROR_EXPECTED, and MediaWiki\EditPage\Constraint\EditFilterMergedContentHookConstraint\formatStatusErrors().

◆ formatStatusErrors()

MediaWiki\EditPage\Constraint\EditFilterMergedContentHookConstraint::formatStatusErrors ( Status  $status)
private

Wrap status errors in error boxes for increased visibility.

Parameters
Status$status
Returns
string

Definition at line 170 of file EditFilterMergedContentHookConstraint.php.

References ApiMessage\create(), Html\errorBox(), and Message\newFromSpecifier().

Referenced by MediaWiki\EditPage\Constraint\EditFilterMergedContentHookConstraint\checkConstraint().

◆ getHookError()

MediaWiki\EditPage\Constraint\EditFilterMergedContentHookConstraint::getHookError ( )

TODO this is really ugly.

The constraint shouldn't know that the status will be used as wikitext, with is what the hookError represents, rather than just the error code. This needs a big refactor to remove the hook error string and just rely on the status object entirely.

Access: internal
Returns
string

Definition at line 161 of file EditFilterMergedContentHookConstraint.php.

◆ getLegacyStatus()

MediaWiki\EditPage\Constraint\EditFilterMergedContentHookConstraint::getLegacyStatus ( )

Get the legacy status for failure (or success)

Called "legacy" status because this part of the interface should probably be redone; Currently Status objects have a value of an IEditObject constant, as well as a fatal message

Returns
StatusValue

Implements MediaWiki\EditPage\Constraint\IEditConstraint.

Definition at line 146 of file EditFilterMergedContentHookConstraint.php.

Member Data Documentation

◆ $content

Content MediaWiki\EditPage\Constraint\EditFilterMergedContentHookConstraint::$content
private

◆ $hookContext

IContextSource MediaWiki\EditPage\Constraint\EditFilterMergedContentHookConstraint::$hookContext
private

◆ $hookError

string MediaWiki\EditPage\Constraint\EditFilterMergedContentHookConstraint::$hookError = ''
private

Definition at line 69 of file EditFilterMergedContentHookConstraint.php.

◆ $hookRunner

HookRunner MediaWiki\EditPage\Constraint\EditFilterMergedContentHookConstraint::$hookRunner
private

Definition at line 45 of file EditFilterMergedContentHookConstraint.php.

◆ $hookUser

User MediaWiki\EditPage\Constraint\EditFilterMergedContentHookConstraint::$hookUser
private

◆ $language

Language MediaWiki\EditPage\Constraint\EditFilterMergedContentHookConstraint::$language
private

◆ $minorEdit

bool MediaWiki\EditPage\Constraint\EditFilterMergedContentHookConstraint::$minorEdit
private

◆ $status

Status MediaWiki\EditPage\Constraint\EditFilterMergedContentHookConstraint::$status
private

Definition at line 66 of file EditFilterMergedContentHookConstraint.php.

◆ $summary

string MediaWiki\EditPage\Constraint\EditFilterMergedContentHookConstraint::$summary
private

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