MediaWiki master
ReadOnlyConstraint.php
Go to the documentation of this file.
1<?php
8
12
21
22 public function __construct(
23 private readonly ReadOnlyMode $readOnlyMode,
24 ) {
25 }
26
27 public function checkConstraint(): EditPageStatus {
28 if ( $this->readOnlyMode->isReadOnly() ) {
29 return EditPageStatus::newFatal( 'readonlytext' )
30 ->setValue( self::AS_READ_ONLY_PAGE )
31 ->setErrorFunction( static fn () => throw new ReadOnlyError() );
32 }
34 }
35
36}
if(!defined('MW_SETUP_CALLBACK'))
Definition WebStart.php:69
Abstract class for all constraints that can prevent edits.
__construct(private readonly ReadOnlyMode $readOnlyMode,)
Status returned by edit constraints and other page editing checks.
setValue(int $value)
Sets the value of the status.
Show an error when the wiki is locked/read-only and the user tries to do something that requires writ...
static newFatal( $message,... $parameters)
Factory function for fatal errors.
static newGood( $value=null)
Factory function for good results.
Determine whether a site is currently in read-only mode.