39 private bool $allowDoubleRedirects;
41 private Content $originalContent;
43 private string $result;
53 bool $allowDoubleRedirects,
59 $this->allowDoubleRedirects = $allowDoubleRedirects;
60 $this->newContent = $newContent;
61 $this->originalContent = $originalContent;
62 $this->title = $title;
63 $this->redirectLookup = $redirectLookup;
67 if ( !$this->allowDoubleRedirects ) {
68 $newRedirectTarget = $this->newContent->getRedirectTarget();
70 if ( $newRedirectTarget !==
null && $newRedirectTarget->isRedirect() &&
71 !$newRedirectTarget->equals( $this->title ) ) {
73 $currentTarget = $this->originalContent->getRedirectTarget();
76 if ( !$currentTarget || !$currentTarget->isRedirect() ) {
77 $this->result = self::CONSTRAINT_FAILED;
79 return self::CONSTRAINT_FAILED;
83 $this->result = self::CONSTRAINT_PASSED;
85 return self::CONSTRAINT_PASSED;
90 if ( $this->result === self::CONSTRAINT_FAILED ) {
91 $realRedirectTarget = $this->redirectLookup->getRedirectTarget( $this->newContent->getRedirectTarget() );
92 $realTargetTitle = Title::castFromLinkTarget( $realRedirectTarget );
95 'edit-constraint-doubleredirect',
98 $statusValue->value = self::AS_DOUBLE_REDIRECT;
wfEscapeWikiText( $input)
Escapes the given text so that it may be output using addWikiText() without any linking,...
if(!defined('MW_SETUP_CALLBACK'))
Verify the page does not redirect to another redirect unless.
__construct(bool $allowDoubleRedirects, Content $newContent, Content $originalContent, LinkTarget $title, RedirectLookup $redirectLookup)
getLegacyStatus()
Get the legacy status for failure (or success)
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Content objects represent page content, e.g.
Interface for all constraints that can prevent edits.
Service for resolving a wiki page redirect.