38 private $allowSelfRedirect;
44 private $originalContent;
59 bool $allowSelfRedirect,
64 $this->allowSelfRedirect = $allowSelfRedirect;
65 $this->newContent = $newContent;
66 $this->originalContent = $originalContent;
67 $this->title = $title;
71 if ( !$this->allowSelfRedirect
72 && $this->newContent->isRedirect()
73 && $this->newContent->getRedirectTarget()->equals( $this->title )
76 $currentTarget = $this->originalContent->getRedirectTarget();
77 if ( !$currentTarget || !$currentTarget->equals( $this->title ) ) {
78 $this->result = self::CONSTRAINT_FAILED;
79 return self::CONSTRAINT_FAILED;
82 $this->result = self::CONSTRAINT_PASSED;
83 return self::CONSTRAINT_PASSED;
88 if ( $this->result === self::CONSTRAINT_FAILED ) {
89 $statusValue->
fatal(
'selfredirect' );
90 $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.
Base interface for representing page content.
Interface for all constraints that can prevent edits.