26 private readonly
Content $newContent,
34 if ( $this->page->getNamespace() ===
NS_FILE &&
35 $this->newContent->isRedirect() &&
36 !$this->performer->isAllowed(
'upload' )
38 $errorCode = $this->performer->getUser()->isRegistered() ?
41 return PageEditStatus::newGood( $errorCode )
43 ->setErrorFunction(
static fn () =>
throw new PermissionsError(
'upload' ) );
46 return PageEditStatus::newGood();
if(!defined('MW_SETUP_CALLBACK'))
Abstract class for all constraints that can prevent edits.
Verify user permissions: If creating a redirect in the file namespace, must have upload rights.
__construct(private readonly Content $newContent, private readonly PageReference $page, private readonly Authority $performer,)
Status returned by edit constraints and other page editing checks.
setOK( $ok)
Change operation status.
Content objects represent page content, e.g.
const AS_IMAGE_REDIRECT_ANON
Status: anonymous user is not allowed to upload (User::isAllowed('upload') == false)
const AS_IMAGE_REDIRECT_LOGGED
Status: logged in user is not allowed to upload (User::isAllowed('upload') == false)