Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4126419
MissingCommentConstraint.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
917 B
Referenced Files
None
Subscribers
None
MissingCommentConstraint.php
View Options
<?php
/**
* @license GPL-2.0-or-later
* @file
*/
namespace
MediaWiki\EditPage\Constraint
;
use
StatusValue
;
/**
* Do not allow the user to post an empty comment (only used for new section)
*
* @since 1.36
* @internal
* @author DannyS712
*/
class
MissingCommentConstraint
implements
IEditConstraint
{
private
bool
$failed
=
false
;
public
function
__construct
(
private
readonly
string
$section
,
private
readonly
string
$userComment
,
)
{
}
public
function
checkConstraint
():
string
{
if
(
$this
->
section
===
'new'
&&
$this
->
userComment
===
''
)
{
$this
->
failed
=
true
;
return
self
::
CONSTRAINT_FAILED
;
}
return
self
::
CONSTRAINT_PASSED
;
}
public
function
getLegacyStatus
():
StatusValue
{
$statusValue
=
StatusValue
::
newGood
();
if
(
$this
->
failed
)
{
$statusValue
->
fatal
(
'missingcommenttext'
);
$statusValue
->
value
=
self
::
AS_TEXTBOX_EMPTY
;
}
return
$statusValue
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, Aug 19, 08:05 (2 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
e6/ed/569b35729d2e84da167b8731c874
Default Alt Text
MissingCommentConstraint.php (917 B)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment