aboutsummaryrefslogtreecommitdiffstats
path: root/includes/editpage/EditPage.php
diff options
context:
space:
mode:
authorSomeRandomDeveloper <thisisnotmyname275@gmail.com>2025-01-23 22:30:04 +0100
committerSomeRandomDeveloper <thisisnotmyname275@gmail.com>2025-02-21 00:32:47 +0000
commit4d237035f3f2d187108748448c286681203627d2 (patch)
tree9908905104e77c7bd8fdde9f7dc72ce1bedd5342 /includes/editpage/EditPage.php
parenta603da0381f028b30d8f4e3cf574d2c3a9e99681 (diff)
downloadmediawikicore-4d237035f3f2d187108748448c286681203627d2.tar.gz
mediawikicore-4d237035f3f2d187108748448c286681203627d2.zip
editpage: Make BrokenRedirectConstraint provide its own error message
Generate the error message in the getLegacyStatus function in the constraint class instead of EditPage. The submit button label has to be passed to the edit constraint since the logic for determining it it resides in EditPage. Bug: T384399 Change-Id: Id2a9ab57198dfa4df07f91b067944e9f9fefb81a
Diffstat (limited to 'includes/editpage/EditPage.php')
-rw-r--r--includes/editpage/EditPage.php15
1 files changed, 6 insertions, 9 deletions
diff --git a/includes/editpage/EditPage.php b/includes/editpage/EditPage.php
index 65ad16a08915..df89d88be439 100644
--- a/includes/editpage/EditPage.php
+++ b/includes/editpage/EditPage.php
@@ -1873,7 +1873,6 @@ class EditPage implements IEditObject {
case self::AS_END:
case self::AS_BLANK_ARTICLE:
case self::AS_SELF_REDIRECT:
- case self::AS_BROKEN_REDIRECT:
case self::AS_DOUBLE_REDIRECT:
case self::AS_REVISION_WAS_DELETED:
return true;
@@ -1883,6 +1882,7 @@ class EditPage implements IEditObject {
// Status codes that provide their own error/warning messages. Most error scenarios that don't
// need custom user interface (e.g. edit conflicts) should be handled here, one day (T384399).
+ case self::AS_BROKEN_REDIRECT:
case self::AS_CONTENT_TOO_BIG:
case self::AS_MAX_ARTICLE_SIZE_EXCEEDED:
case self::AS_PARSE_ERROR:
@@ -2497,6 +2497,9 @@ class EditPage implements IEditObject {
// Check for length errors again now that the section is merged in
$this->contentLength = strlen( $this->toEditText( $content ) );
+ // Message key of the label of the submit button - used by some constraint error messages
+ $submitButtonLabel = $this->getSubmitButtonLabel();
+
// BEGINNING OF MIGRATION TO EDITCONSTRAINT SYSTEM (see T157658)
// Create a new runner to avoid rechecking the prior constraints, use the same factory
$constraintRunner = new EditConstraintRunner();
@@ -2513,7 +2516,8 @@ class EditPage implements IEditObject {
$this->allowBrokenRedirects,
$content,
$this->getCurrentContent(),
- $this->getTitle()
+ $this->getTitle(),
+ $submitButtonLabel
)
);
$constraintRunner->addConstraint(
@@ -3401,13 +3405,6 @@ class EditPage implements IEditObject {
);
}
- if ( $this->brokenRedirect ) {
- $out->wrapWikiMsg(
- "<div id='mw-brokenredirect'>\n$1\n</div>",
- [ 'edit-constraint-brokenredirect', $buttonLabel ]
- );
- }
-
if ( $this->doubleRedirect ) {
$editContent = $this->toEditContent( $this->textbox1 );
$redirectTarget = $editContent->getRedirectTarget();