Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7406951
AccidentalRecreationConstraint.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
903 B
Referenced Files
None
Subscribers
None
AccidentalRecreationConstraint.php
View Options
<?php
/**
* @license GPL-2.0-or-later
* @file
*/
namespace
MediaWiki\EditPage\Constraint
;
use
StatusValue
;
/**
* Make sure user doesn't accidentally recreate a page deleted after they started editing
*
* @since 1.36
* @internal
* @author DannyS712
*/
class
AccidentalRecreationConstraint
implements
IEditConstraint
{
public
function
__construct
(
private
readonly
bool
$deletedSinceLastEdit
,
private
readonly
bool
$allowRecreation
,
)
{
}
public
function
checkConstraint
():
string
{
if
(
$this
->
deletedSinceLastEdit
&&
!
$this
->
allowRecreation
)
{
return
self
::
CONSTRAINT_FAILED
;
}
return
self
::
CONSTRAINT_PASSED
;
}
public
function
getLegacyStatus
():
StatusValue
{
$statusValue
=
StatusValue
::
newGood
();
if
(
$this
->
deletedSinceLastEdit
&&
!
$this
->
allowRecreation
)
{
$statusValue
->
setResult
(
false
,
self
::
AS_ARTICLE_WAS_DELETED
);
}
return
$statusValue
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Nov 21, 20:41 (1 d, 11 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
8f/44/fc9150d47b8d589be33a22730af4
Default Alt Text
AccidentalRecreationConstraint.php (903 B)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment