50 private string $section;
51 private string $userSummary;
52 private string $autoSummary;
53 private bool $allowBlankSummary;
55 private ?
Content $originalContent;
56 private string $result;
70 bool $allowBlankSummary,
74 $this->section = $section;
75 $this->userSummary = $userSummary;
76 $this->autoSummary = $autoSummary;
77 $this->allowBlankSummary = $allowBlankSummary;
78 $this->newContent = $newContent;
79 $this->originalContent = $originalContent;
83 if ( $this->section ===
'new' ) {
85 $this->result = self::CONSTRAINT_PASSED;
86 return self::CONSTRAINT_PASSED;
88 if ( $this->originalContent ===
null ) {
90 $this->result = self::CONSTRAINT_FAILED;
91 return self::CONSTRAINT_FAILED;
94 !$this->allowBlankSummary &&
95 !$this->newContent->equals( $this->originalContent ) &&
96 !$this->newContent->isRedirect() &&
97 md5( $this->userSummary ) === $this->autoSummary
99 $this->result = self::CONSTRAINT_FAILED;
101 $this->result = self::CONSTRAINT_PASSED;
103 return $this->result;
108 if ( $this->result === self::CONSTRAINT_FAILED ) {
109 if ( $this->originalContent ===
null ) {
114 $statusValue->
fatal(
'rev-deleted-text-permission' );
115 $statusValue->value = self::AS_REVISION_WAS_DELETED;
117 $statusValue->fatal(
'missingsummary' );
118 $statusValue->value = self::AS_SUMMARY_NEEDED;
if(!defined('MW_SETUP_CALLBACK'))
To simplify the logic in EditPage, this constraint may be created even if the section being edited do...
getLegacyStatus()
Get the legacy status for failure (or success)
__construct(string $section, string $userSummary, string $autoSummary, bool $allowBlankSummary, Content $newContent, ?Content $originalContent)
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.