MediaWiki REL1_39
MediaWiki\EditPage\Constraint\PageSizeConstraint Class Reference

Verify the page isn't larger than the maximum. More...

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

Public Member Functions

 __construct (int $maxSize, int $contentSize, string $type)
 
 checkConstraint ()
 
 getLegacyStatus ()
 Get the legacy status for failure (or success)
 
 getType ()
 Get the type, so that the two different uses of this constraint can be told apart in debug logs.
 

Public Attributes

const AFTER_MERGE = 'check-after-edit-merge'
 
const BEFORE_MERGE = 'check-before-edit-merge'
 Same constraint is used for two different errors, use these to specify which one should be used.
 
- 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.
 
const AS_BLANK_ARTICLE = 224
 Status: user tried to create a blank page and wpIgnoreBlankArticle == false.
 
const AS_BLOCKED_PAGE_FOR_USER = 215
 Status: User is blocked from editing this page.
 
const AS_CHANGE_TAG_ERROR = 237
 Status: an error relating to change tagging.
 
const AS_CONFLICT_DETECTED = 225
 Status: (non-resolvable) edit conflict.
 
const AS_CONTENT_TOO_BIG = 216
 Status: Content too big (> $wgMaxArticleSize)
 
const AS_END = 231
 Status: WikiPage::doEdit() was unsuccessful.
 
const AS_HOOK_ERROR = 210
 Status: Article update aborted by a hook function.
 
const AS_HOOK_ERROR_EXPECTED = 212
 Status: A hook function returned an error.
 
const AS_IMAGE_REDIRECT_ANON = 233
 Status: anonymous user is not allowed to upload (User::isAllowed('upload') == false)
 
const AS_IMAGE_REDIRECT_LOGGED = 234
 Status: logged in user is not allowed to upload (User::isAllowed('upload') == false)
 
const AS_MAX_ARTICLE_SIZE_EXCEEDED = 229
 Status: article is too big (> $wgMaxArticleSize), after merging in the new section.
 
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 )
 
const AS_NO_CREATE_PERMISSION = 223
 Status: user tried to create this page, but is not allowed to do that.
 
const AS_PARSE_ERROR = 240
 Status: can't parse content.
 
const AS_RATE_LIMITED = 221
 Status: rate limiter for action 'edit' was tripped.
 
const AS_READ_ONLY_PAGE = 220
 Status: wiki is in readonly mode (ReadOnlyMode::isReadOnly() == true)
 
const AS_READ_ONLY_PAGE_ANON = 218
 Status: this anonymous user is not allowed to edit this page.
 
const AS_READ_ONLY_PAGE_LOGGED = 219
 Status: this logged in user is not allowed to edit this page.
 
const AS_SELF_REDIRECT = 236
 Status: user tried to create self-redirect and wpIgnoreSelfRedirect is false.
 
const AS_SPAM_ERROR = 232
 Status: summary contained spam according to one of the regexes in $wgSummarySpamRegex.
 
const AS_SUCCESS_NEW_ARTICLE = 201
 Status: Article successfully created.
 
const AS_SUCCESS_UPDATE = 200
 Status: Article successfully updated.
 
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.
 
const AS_TEXTBOX_EMPTY = 228
 Status: user tried to create a new section without content.
 
const AS_UNICODE_NOT_SUPPORTED = 242
 Status: edit rejected because browser doesn't support Unicode.
 

Detailed Description

Verify the page isn't larger than the maximum.

This is used for both checking the size //before// merging the edit, and checking the size //after// applying the edit, and the result codes they return are different.

Since
1.36
Access: internal
Author
DannyS712

Definition at line 36 of file PageSizeConstraint.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\EditPage\Constraint\PageSizeConstraint::__construct ( int $maxSize,
int $contentSize,
string $type )
Parameters
int$maxSizeIn kibibytes, from $wgMaxArticleSize
int$contentSize
string$type

Definition at line 62 of file PageSizeConstraint.php.

References $type, MediaWiki\EditPage\IEditObject\AS_CONTENT_TOO_BIG, and MediaWiki\EditPage\IEditObject\AS_MAX_ARTICLE_SIZE_EXCEEDED.

Member Function Documentation

◆ checkConstraint()

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

Implements MediaWiki\EditPage\Constraint\IEditConstraint.

Definition at line 81 of file PageSizeConstraint.php.

◆ getLegacyStatus()

MediaWiki\EditPage\Constraint\PageSizeConstraint::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 87 of file PageSizeConstraint.php.

References StatusValue\setResult().

◆ getType()

MediaWiki\EditPage\Constraint\PageSizeConstraint::getType ( )

Get the type, so that the two different uses of this constraint can be told apart in debug logs.

Access: internal
Returns
string

Definition at line 104 of file PageSizeConstraint.php.

Member Data Documentation

◆ AFTER_MERGE

const MediaWiki\EditPage\Constraint\PageSizeConstraint::AFTER_MERGE = 'check-after-edit-merge'

Definition at line 43 of file PageSizeConstraint.php.

◆ BEFORE_MERGE

const MediaWiki\EditPage\Constraint\PageSizeConstraint::BEFORE_MERGE = 'check-before-edit-merge'

Same constraint is used for two different errors, use these to specify which one should be used.

Definition at line 42 of file PageSizeConstraint.php.


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