36 private string $result;
47 private readonly
string $section,
48 private readonly
string $userSummary,
49 private readonly
string $autoSummary,
50 private readonly
bool $allowBlankSummary,
51 private readonly
Content $newContent,
52 private readonly ?
Content $originalContent,
57 if ( $this->section ===
'new' ) {
59 $this->result = self::CONSTRAINT_PASSED;
60 return self::CONSTRAINT_PASSED;
62 if ( $this->originalContent ===
null ) {
64 $this->result = self::CONSTRAINT_FAILED;
65 return self::CONSTRAINT_FAILED;
68 !$this->allowBlankSummary &&
69 !$this->newContent->equals( $this->originalContent ) &&
70 !$this->newContent->isRedirect() &&
71 md5( $this->userSummary ) === $this->autoSummary
73 $this->result = self::CONSTRAINT_FAILED;
75 $this->result = self::CONSTRAINT_PASSED;
82 if ( $this->result === self::CONSTRAINT_FAILED ) {
83 if ( $this->originalContent ===
null ) {
88 $statusValue->
fatal(
'rev-deleted-text-permission' );
89 $statusValue->value = self::AS_REVISION_WAS_DELETED;
91 $statusValue->fatal(
'missingsummary' );
92 $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(private readonly string $section, private readonly string $userSummary, private readonly string $autoSummary, private readonly bool $allowBlankSummary, private readonly Content $newContent, private readonly ?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.
Content objects represent page content, e.g.
Interface for all constraints that can prevent edits.