37 private bool $allowSelfRedirect;
39 private Content $originalContent;
41 private string $result;
50 bool $allowSelfRedirect,
55 $this->allowSelfRedirect = $allowSelfRedirect;
56 $this->newContent = $newContent;
57 $this->originalContent = $originalContent;
58 $this->title = $title;
62 if ( !$this->allowSelfRedirect
63 && $this->newContent->isRedirect()
64 && $this->newContent->getRedirectTarget()->equals( $this->title )
67 $currentTarget = $this->originalContent->getRedirectTarget();
68 if ( !$currentTarget || !$currentTarget->equals( $this->title ) ) {
69 $this->result = self::CONSTRAINT_FAILED;
70 return self::CONSTRAINT_FAILED;
73 $this->result = self::CONSTRAINT_PASSED;
74 return self::CONSTRAINT_PASSED;
79 if ( $this->result === self::CONSTRAINT_FAILED ) {
80 $statusValue->
fatal(
'selfredirect' );
81 $statusValue->value = self::AS_SELF_REDIRECT;
if(!defined('MW_SETUP_CALLBACK'))
Verify the page does not redirect to itself unless.
getLegacyStatus()
Get the legacy status for failure (or success)
__construct(bool $allowSelfRedirect, Content $newContent, Content $originalContent, LinkTarget $title)
Generic operation result class Has warning/error list, boolean status and arbitrary value.
fatal( $message,... $parameters)
Add an error and set OK to false, indicating that the operation as a whole was fatal.
Content objects represent page content, e.g.
Interface for all constraints that can prevent edits.