MediaWiki REL1_37
AccidentalRecreationConstraint.php
Go to the documentation of this file.
1<?php
22
23use StatusValue;
24
33
36
39
44 public function __construct(
47 ) {
48 $this->deletedSinceLastEdit = $deletedSinceLastEdit;
49 $this->allowRecreation = $allowRecreation;
50 }
51
52 public function checkConstraint(): string {
53 if ( $this->deletedSinceLastEdit && !$this->allowRecreation ) {
54 return self::CONSTRAINT_FAILED;
55 }
56 return self::CONSTRAINT_PASSED;
57 }
58
59 public function getLegacyStatus(): StatusValue {
60 $statusValue = StatusValue::newGood();
61 if ( $this->deletedSinceLastEdit && !$this->allowRecreation ) {
62 $statusValue->setResult( false, self::AS_ARTICLE_WAS_DELETED );
63 }
64 return $statusValue;
65 }
66
67}
if(ini_get('mbstring.func_overload')) if(!defined('MW_ENTRY_POINT'))
Pre-config setup: Before loading LocalSettings.php.
Definition Setup.php:88
Make sure user doesn't accidentally recreate a page deleted after they started editing.
__construct(bool $deletedSinceLastEdit, bool $allowRecreation)
Generic operation result class Has warning/error list, boolean status and arbitrary value.
setResult( $ok, $value=null)
Change operation result.
Interface for all constraints that can prevent edits.