MediaWiki  master
StatusValue Class Reference

Generic operation result class Has warning/error list, boolean status and arbitrary value. More...

Inheritance diagram for StatusValue:

Public Member Functions

 __toString ()
 
 error ( $message,... $parameters)
 Add an error, do not set fatal flag This can be used for non-fatal errors. More...
 
 fatal ( $message,... $parameters)
 Add an error and set OK to false, indicating that the operation as a whole was fatal. More...
 
 getErrors ()
 Get the list of errors. More...
 
 getErrorsByType ( $type)
 Returns a list of status messages of the given type. More...
 
 getValue ()
 
 hasMessage ( $message)
 Returns true if the specified message is present as a warning or error. More...
 
 isGood ()
 Returns whether the operation completed and didn't have any error or warnings. More...
 
 isOK ()
 Returns whether the operation completed. More...
 
 merge ( $other, $overwriteValue=false)
 Merge another status object into this one. More...
 
 replaceMessage ( $source, $dest)
 If the specified source message exists, replace it with the specified destination message, but keep the same parameters as in the original error. More...
 
 setOK ( $ok)
 Change operation status. More...
 
 setResult ( $ok, $value=null)
 Change operation result. More...
 
 splitByErrorType ()
 Splits this StatusValue object into two new StatusValue objects, one which contains only the error messages, and one that contains the warnings, only. More...
 
 warning ( $message,... $parameters)
 Add a new warning. More...
 

Static Public Member Functions

static newFatal ( $message,... $parameters)
 Factory function for fatal errors. More...
 
static newGood ( $value=null)
 Factory function for good results. More...
 

Public Attributes

int $failCount = 0
 Counter for batch operations. More...
 
bool[] $success = []
 Map of (key => bool) to indicate success of each part of batch operations. More...
 
int $successCount = 0
 Counter for batch operations. More...
 
mixed $value
 

Protected Member Functions

 getStatusArray ( $type=false)
 Returns a list of status messages of the given type (or all if false) More...
 

Protected Attributes

array[] $errors = []
 
bool $ok = true
 

Private Member Functions

 addError (array $newError)
 Add a new error to the error array ($this->errors) if that error is not already in the error array. More...
 
 flattenParams (array $params)
 

Detailed Description

Generic operation result class Has warning/error list, boolean status and arbitrary value.

"Good" means the operation was completed with no warnings or errors.

"OK" means the operation was partially or wholly completed.

An operation which is not OK should have errors so that the user can be informed as to what went wrong. Calling the fatal() function sets an error message and simultaneously switches off the OK flag.

The recommended pattern for Status objects is to return a StatusValue unconditionally, i.e. both on success and on failure – so that the developer of the calling code is reminded that the function can fail, and so that a lack of error-handling will be explicit.

The use of Message objects should be avoided when serializability is needed.

@newable

Since
1.25

Definition at line 43 of file StatusValue.php.

Member Function Documentation

◆ __toString()

StatusValue::__toString ( )
Returns
string

Definition at line 363 of file StatusValue.php.

References flattenParams(), and isOK().

◆ addError()

StatusValue::addError ( array  $newError)
private

Add a new error to the error array ($this->errors) if that error is not already in the error array.

Each error is passed as an array with the following fields:

  • type: 'error' or 'warning'
  • message: a string (message key) or MessageSpecifier
  • params: an array of string parameters

If the new error is of type 'error' and it matches an existing error of type 'warning', the existing error is upgraded to type 'error'. An error provided as a MessageSpecifier will successfully match an error provided as the same string message key and array of parameters as separate array elements.

Parameters
array$newError
Returns
$this

Definition at line 193 of file StatusValue.php.

Referenced by error(), merge(), and warning().

◆ error()

StatusValue::error (   $message,
  $parameters 
)

Add an error, do not set fatal flag This can be used for non-fatal errors.

Parameters
string | MessageSpecifier$messageMessage key or object
mixed...$parameters
Returns
$this

Definition at line 250 of file StatusValue.php.

References addError().

Referenced by MediaWiki\Storage\PageUpdater\checkAllRequiredRoles(), MediaWiki\Storage\PageUpdater\checkAllRolesAllowed(), MediaWiki\Storage\PageUpdater\checkAllRolesDerived(), MediaWiki\Storage\PageUpdater\checkNoRolesRequired(), fatal(), and LocalFileDeleteBatch\getHashes().

◆ fatal()

StatusValue::fatal (   $message,
  $parameters 
)

Add an error and set OK to false, indicating that the operation as a whole was fatal.

Parameters
string | MessageSpecifier$messageMessage key or object
mixed...$parameters
Returns
$this

Definition at line 266 of file StatusValue.php.

References error().

Referenced by MediaWiki\Permissions\SimpleAuthority\checkPermission(), MediaWiki\Storage\PageUpdater\doCreate(), MediaWiki\Storage\PageUpdater\doModify(), Status\getMessage(), Status\getWikiText(), and MediaWiki\Storage\PageUpdater\updateRevision().

◆ flattenParams()

StatusValue::flattenParams ( array  $params)
private
Parameters
array$paramsMessage parameters
Returns
string String representation

Definition at line 425 of file StatusValue.php.

Referenced by __toString().

◆ getErrors()

StatusValue::getErrors ( )

Get the list of errors.

Each error is a (message:string or MessageSpecifier,params:array) map

Returns
array[]

Definition at line 149 of file StatusValue.php.

References $errors.

Referenced by Status\__get(), ApiErrorFormatter\addMessagesFromStatus(), ApiErrorFormatter\arrayFromStatus(), ApiErrorFormatter_BackCompat\arrayFromStatus(), Status\getMessage(), getStatusArray(), and Status\getWikiText().

◆ getErrorsByType()

StatusValue::getErrorsByType (   $type)

Returns a list of status messages of the given type.

Each entry is a map of:

  • message: string message key or MessageSpecifier
  • params: array list of parameters
Parameters
string$type
Returns
array[]

Definition at line 301 of file StatusValue.php.

References $type.

Referenced by ApiErrorFormatter_BackCompat\arrayFromStatus(), and ApiBase\dieStatus().

◆ getStatusArray()

StatusValue::getStatusArray (   $type = false)
protected

Returns a list of status messages of the given type (or all if false)

Note
this handles RawMessage poorly
Parameters
string | bool$type
Returns
array[]

Definition at line 447 of file StatusValue.php.

References $type, and getErrors().

Referenced by Status\getErrorsArray(), Status\getWarningsArray(), and MediaWiki\Permissions\PermissionStatus\toLegacyErrorArray().

◆ getValue()

◆ hasMessage()

StatusValue::hasMessage (   $message)

Returns true if the specified message is present as a warning or error.

Parameters
string | MessageSpecifier$messageMessage key or object to search for
Returns
bool

Definition at line 319 of file StatusValue.php.

Referenced by ApiBase\addBlockInfoToStatus(), and Article\doOutputFromRenderStatus().

◆ isGood()

◆ isOK()

◆ merge()

StatusValue::merge (   $other,
  $overwriteValue = false 
)

Merge another status object into this one.

Parameters
StatusValue$other
bool$overwriteValueWhether to override the "value" member
Returns
$this

Definition at line 278 of file StatusValue.php.

References addError().

Referenced by ScopedLock\factory(), MediaWiki\Storage\PageUpdater\makeNewRevision(), FileOpBatch\runParallelBatches(), SpecialSearch\showResults(), and Page\UndeletePage\undeleteUnsafe().

◆ newFatal()

static StatusValue::newFatal (   $message,
  $parameters 
)
static

Factory function for fatal errors.

Parameters
string | MessageSpecifier$messageMessage key or object
mixed...$parameters
Returns
static

Definition at line 70 of file StatusValue.php.

Referenced by CliInstaller\__construct(), MWHttpRequest\__construct(), UploadFromChunks\addChunk(), User\addToDatabase(), MediaWiki\Watchlist\WatchlistManager\addWatchIgnoringRights(), FileOp\attempt(), SpecialChangeEmail\attemptChange(), MediaWiki\Auth\AuthManager\autoCreateUser(), ChangeTags\canActivateTag(), ChangeTags\canAddTagsAccompanyingChange(), MediaWiki\Auth\AuthManager\canCreateAccount(), ChangeTags\canCreateTag(), ChangeTags\canDeactivateTag(), ChangeTags\canDeleteTag(), ChangeTags\canUpdateTags(), SpecialPageLanguage\changePageLanguage(), MediaWiki\Auth\AuthManager\checkAccountCreatePermissions(), SqliteInstaller\checkDataDir(), Page\ParserOutputAccess\checkPreconditions(), ImportReporter\close(), PasswordReset\computeIsAllowed(), UploadBase\convertVerifyErrorToStatus(), SqliteInstaller\createDataDir(), ContentModelChange\createNewContent(), Installer\createSysop(), ApiDelete\delete(), ApiDelete\deleteFile(), SpecialRedirect\dispatchFile(), SpecialRedirect\dispatchLog(), SpecialRedirect\dispatchPage(), SpecialRedirect\dispatchRevision(), SpecialRedirect\dispatchUser(), FileDeleteForm\doDelete(), Installer\doEnvironmentChecks(), SpecialImport\doImport(), MediaWiki\Storage\PageUpdater\doUpdate(), WikiPage\doUpdateRestrictions(), UserrightsPage\execute(), PoolCounterWork\execute(), LoginSignupSpecialPage\execute(), SpecialChangeCredentials\execute(), SpecialLinkAccounts\execute(), SpecialUnlinkAccounts\execute(), ApiEmailUser\execute(), ApiImageRotate\execute(), CliInstaller\execute(), ZipDirectoryReader\execute(), PasswordReset\execute(), UploadFromUrl\fetchFile(), Article\fetchRevisionRecord(), UserrightsPage\fetchUser(), PoolCounterRedis\getConnection(), Installer\getExtensionInfo(), Page\ParserOutputAccess\getParserOutput(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\getPasswordResetData(), WebInstallerExistingWiki\handleExistingUpgrade(), ApiUpload\handleStashException(), Deflate\inflate(), MediaWiki\User\BotPasswordStore\insertBotPassword(), EditPage\internalAttemptSave(), ChangeTags\isTagNameValid(), ApiAuthManagerHelper\logAuthenticationResult(), BotPassword\login(), SqliteInstaller\makeStubDBFile(), DatabaseInstaller\meetsMinimumRequirement(), MovePage\moveSubpagesIfAllowed(), MovePage\moveSubpagesInternal(), FileRepo\newFatal(), User\newFatalPermissionDeniedStatus(), ImportStreamSource\newFromFile(), ImportStreamSource\newFromInterwiki(), ImportStreamSource\newFromUpload(), ImportStreamSource\newFromURL(), FileBackend\newStatus(), ApiUsageException\newWithMessage(), SpecialRedirectWithAction\onFormSubmit(), McrUndoAction\onSubmit(), RevertAction\onSubmit(), SpecialChangeContentModel\onSubmit(), SpecialLockdb\onSubmit(), SpecialPageLanguage\onSubmit(), SpecialRandomInCategory\onSubmit(), SpecialUnlockdb\onSubmit(), SpecialExpandTemplates\onSubmitInput(), FormatJson\parse(), ApiUpload\performStash(), UploadBase\performUpload(), MediaWiki\Block\BlockUser\placeBlock(), MediaWiki\Block\BlockUser\placeBlockInternal(), MediaWiki\Block\BlockUser\placeBlockUnsafe(), DatabaseInstaller\populateInterwikiTable(), MediaWiki\Auth\UserDataAuthenticationRequest\populateUser(), FileOp\precheck(), PoolCounter\precheckAcquire(), AbstractContent\prepareSave(), Installer\readExtension(), UploadFromUrl\reallyFetchFile(), LocalFile\recordUpload3(), PoolCounterRedis\release(), LocalFileDeleteBatch\removeNonexistentFiles(), LocalFileMoveBatch\removeNonexistentFiles(), LocalFileRestoreBatch\removeNonexistentFiles(), MediaWiki\Watchlist\WatchlistManager\removeWatchIgnoringRights(), ChangeTags\restrictedTagError(), Page\RollbackPage\rollback(), AssembleUploadChunksJob\run(), PublishStashedFileJob\run(), SpecialBotPasswords\save(), MediaWiki\Preferences\DefaultPreferencesFactory\saveFormData(), MediaWiki\Storage\PageUpdater\saveRevision(), UserrightsPage\saveUserGroups(), UserMailer\send(), SpecialEmailUser\sendEmailForm(), UserMailer\sendInternal(), UserMailer\sendWithPear(), User\setEmailWithConfirmation(), SqliteInstaller\setupDatabase(), PostgresInstaller\setupPLpgSQL(), PostgresInstaller\setupSchema(), PostgresInstaller\setupUser(), RevDelList\setVisibility(), SpecialUploadStash\showUploads(), MediaTransformOutput\streamFileWithStatus(), WebInstallerDBConnect\submit(), SpecialEditTags\submit(), SpecialEmailUser\submit(), SpecialConfirmEmail\submitSend(), MysqlInstaller\submitSettingsForm(), PostgresInstaller\submitSettingsForm(), DatabaseInstaller\submitWebUserBox(), SpecialLinkAccounts\success(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\testForAccountCreation(), MediaWiki\Auth\CheckBlocksSecondaryAuthenticationProvider\testUserForCreation(), UploadBase\tryStashFile(), UploadFromChunks\tryStashFile(), AuthManagerSpecialPage\trySubmit(), Page\UndeletePage\undeleteRevisions(), MediaWiki\User\BotPasswordStore\updateBotPassword(), MediaWiki\Storage\PageUpdater\updateRevision(), ChangeTags\updateTagsWithChecks(), ContentHandler\validateSave(), and PoolCounterRedis\waitForSlotOrNotif().

◆ newGood()

static StatusValue::newGood (   $value = null)
static

Factory function for good results.

Parameters
mixed | null$value
Returns
static

Definition at line 82 of file StatusValue.php.

References $value.

Referenced by MWHttpRequest\__construct(), MediaWiki\EditPage\Constraint\EditFilterMergedContentHookConstraint\__construct(), PoolCounterNull\acquireForAnyone(), PoolCounterNull\acquireForMe(), RevDelList\acquireItemLocks(), LocalFileMoveBatch\acquireSourceLock(), LocalFileMoveBatch\acquireTargetLock(), ChangeTags\activateTagWithChecks(), ChangeTags\addTagsAccompanyingChangeWithChecks(), User\addToDatabase(), MediaWiki\Watchlist\WatchlistManager\addWatchIgnoringRights(), MediaWiki\Auth\AuthManager\allowsAuthenticationDataChange(), FileOp\attempt(), FileOpBatch\attempt(), MediaWiki\Auth\AuthManager\autoCreateUser(), ChangeTags\canActivateTag(), ChangeTags\canAddTagsAccompanyingChange(), MediaWiki\Auth\AuthManager\canCreateAccount(), ChangeTags\canCreateTag(), ChangeTags\canDeactivateTag(), ChangeTags\canDeleteTag(), ChangeTags\canUpdateTags(), User\changeAuthenticationData(), SpecialPageLanguage\changePageLanguage(), MWRestrictions\check(), MediaWiki\Auth\AuthManager\checkAccountCreatePermissions(), SqliteInstaller\checkDataDir(), PasswordPolicyChecks\checkMaximalPasswordLength(), PasswordPolicyChecks\checkMinimalPasswordLength(), PasswordPolicyChecks\checkMinimumPasswordLengthToLogin(), PasswordPolicyChecks\checkPasswordCannotBeSubstringInUsername(), PasswordPolicyChecks\checkPasswordCannotMatchDefaults(), PasswordPolicyChecks\checkPasswordNotInCommonList(), User\checkPasswordValidity(), UserPasswordPolicy\checkPolicies(), DatabaseInstaller\checkPrerequisites(), LocalRepo\cleanupDeletedBatch(), ImportReporter\close(), FSLockManager\closeLockHandles(), QuorumLockManager\collectPledgeQuorum(), PostgresInstaller\commitChanges(), PasswordReset\computeIsAllowed(), MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProvider\continueLinkAttempt(), SqliteInstaller\createDataDir(), Installer\createMainpage(), PostgresInstaller\createManualTables(), SqliteInstaller\createManualTables(), ContentModelChange\createNewContent(), Installer\createSysop(), ChangeTags\createTagWithChecks(), ChangeTags\deactivateTagWithChecks(), Page\DeletePage\deleteInternal(), ChangeTags\deleteTagEverywhere(), Page\DeletePage\deleteUnsafe(), ApiUpload\dieRecoverableError(), ApiBase\dieStatus(), ApiUpload\dieStatusWithCode(), SpecialRedirect\dispatchFile(), SpecialRedirect\dispatchLog(), SpecialRedirect\dispatchPage(), SpecialRedirect\dispatchRevision(), SpecialRedirect\dispatchUser(), CopyFileOp\doAttempt(), CreateFileOp\doAttempt(), FileOp\doAttempt(), MoveFileOp\doAttempt(), StoreFileOp\doAttempt(), ContentModelChange\doContentModelChange(), MediaWiki\Storage\PageUpdater\doCreate(), Installer\doEnvironmentChecks(), Installer\doGenerateKeys(), MySqlLockManager\doGetLocksOnServer(), PostgreSqlLockManager\doGetLocksOnServer(), FSLockManager\doLock(), NullLockManager\doLock(), LockManager\doLockByType(), QuorumLockManager\doLockByType(), MediaWiki\Storage\PageUpdater\doModify(), RevDelArchiveList\doPostCommitUpdates(), RevDelFileList\doPostCommitUpdates(), RevDelList\doPostCommitUpdates(), RevDelRevisionList\doPostCommitUpdates(), CopyFileOp\doPrecheck(), CreateFileOp\doPrecheck(), DeleteFileOp\doPrecheck(), DescribeFileOp\doPrecheck(), FileOp\doPrecheck(), MoveFileOp\doPrecheck(), StoreFileOp\doPrecheck(), RevDelArchiveList\doPreCommitUpdates(), RevDelFileList\doPreCommitUpdates(), RevDelList\doPreCommitUpdates(), RevDelRevisionList\doPreCommitUpdates(), SearchEngine\doSearchArchiveTitle(), FSLockManager\doSingleLock(), FSLockManager\doSingleUnlock(), FSLockManager\doUnlock(), NullLockManager\doUnlock(), LockManager\doUnlockByType(), QuorumLockManager\doUnlockByType(), MediaWiki\Storage\PageUpdater\doUpdate(), WikiPage\doUpdateRestrictions(), ApiBase\errorArrayToStatus(), SpecialUnlinkAccounts\execute(), CliInstaller\execute(), ZipDirectoryReader\execute(), PasswordReset\execute(), UploadBase\fetchFile(), Article\fetchRevisionRecord(), UserrightsPage\fetchUser(), Installer\findExtensionsByType(), DBLockManager\freeLocksOnServer(), MemcLockManager\freeLocksOnServer(), RedisLockManager\freeLocksOnServer(), MediaWiki\Storage\SqlBlobStore\getBlobBatch(), ApiUpload\getChunkResult(), DatabaseInstaller\getConnection(), PoolCounterRedis\getConnection(), Installer\getExtensionInfo(), MediaWiki\EditPage\Constraint\AccidentalRecreationConstraint\getLegacyStatus(), MediaWiki\EditPage\Constraint\AutoSummaryMissingSummaryConstraint\getLegacyStatus(), MediaWiki\EditPage\Constraint\ChangeTagsConstraint\getLegacyStatus(), MediaWiki\EditPage\Constraint\ContentModelChangeConstraint\getLegacyStatus(), MediaWiki\EditPage\Constraint\CreationPermissionConstraint\getLegacyStatus(), MediaWiki\EditPage\Constraint\DefaultTextConstraint\getLegacyStatus(), MediaWiki\EditPage\Constraint\EditRightConstraint\getLegacyStatus(), MediaWiki\EditPage\Constraint\ImageRedirectConstraint\getLegacyStatus(), MediaWiki\EditPage\Constraint\MissingCommentConstraint\getLegacyStatus(), MediaWiki\EditPage\Constraint\NewSectionMissingSummaryConstraint\getLegacyStatus(), MediaWiki\EditPage\Constraint\PageSizeConstraint\getLegacyStatus(), MediaWiki\EditPage\Constraint\ReadOnlyConstraint\getLegacyStatus(), MediaWiki\EditPage\Constraint\SelfRedirectConstraint\getLegacyStatus(), MediaWiki\EditPage\Constraint\SimpleAntiSpamConstraint\getLegacyStatus(), MediaWiki\EditPage\Constraint\SpamRegexConstraint\getLegacyStatus(), MediaWiki\EditPage\Constraint\UnicodeConstraint\getLegacyStatus(), MediaWiki\EditPage\Constraint\UserBlockConstraint\getLegacyStatus(), MediaWiki\EditPage\Constraint\UserRateLimitConstraint\getLegacyStatus(), DBLockManager\getLocksOnServer(), MemcLockManager\getLocksOnServer(), RedisLockManager\getLocksOnServer(), Page\ParserOutputAccess\getParserOutput(), PostgresInstaller\getPgConnection(), AuthManagerSpecialPage\handleFormSubmit(), SpecialChangeCredentials\handleFormSubmit(), SpecialUnlinkAccounts\handleFormSubmit(), WebInstallerExistingWiki\importVariables(), Installer\includeExtensions(), Deflate\inflate(), MediaWiki\User\BotPasswordStore\insertBotPassword(), EditPage\internalAttemptSave(), ChangeTags\isTagNameValid(), RevDelItem\lock(), ApiAuthManagerHelper\logAuthenticationResult(), BotPassword\login(), LoginSignupSpecialPage\mainLoginForm(), SqliteInstaller\makeStubDBFile(), DatabaseInstaller\meetsMinimumRequirement(), MovePage\moveFile(), MovePage\moveSubpagesInternal(), MovePage\moveUnsafe(), ImportStreamSource\newFromFile(), ImportStreamSource\newFromURL(), FileRepo\newGood(), FileBackend\newStatus(), McrUndoAction\onSubmit(), SpecialBotPasswords\onSubmit(), SpecialLockdb\onSubmit(), SpecialUnlockdb\onSubmit(), SpecialExpandTemplates\onSubmitInput(), MysqlInstaller\openConnection(), SqliteInstaller\openConnection(), PostgresInstaller\openConnectionToAnyDB(), PostgresInstaller\openConnectionWithParams(), FormatJson\parse(), ApiUpload\performUpload(), MediaWiki\Block\BlockUser\placeBlock(), MediaWiki\Block\BlockUser\placeBlockInternal(), DatabaseInstaller\populateInterwikiTable(), Installer\populateSiteStats(), MediaWiki\Auth\UserDataAuthenticationRequest\populateUser(), FileOp\precheck(), PoolCounter\precheckAcquire(), FileOp\precheckDestExistence(), AbstractContent\prepareSave(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\providerAllowsAuthenticationDataChange(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\providerAllowsAuthenticationDataChange(), FSLockManager\pruneKeyLockFiles(), Installer\readExtension(), LocalFile\recordUpload3(), PoolCounterNull\release(), PoolCounterRedis\release(), MySqlLockManager\releaseAllLocks(), MemcLockManager\releaseAllLocks(), PostgreSqlLockManager\releaseAllLocks(), RedisLockManager\releaseAllLocks(), RevDelList\releaseItemLocks(), QuorumLockManager\releasePledges(), LocalFileDeleteBatch\removeNonexistentFiles(), LocalFileMoveBatch\removeNonexistentFiles(), LocalFileRestoreBatch\removeNonexistentFiles(), MediaWiki\Watchlist\WatchlistManager\removeWatchIgnoringRights(), Installer\restoreServices(), Page\RollbackPage\rollback(), AssembleUploadChunksJob\run(), PublishStashedFileJob\run(), ApiQueryRevisions\run(), BotPassword\save(), MediaWiki\Storage\PageUpdater\saveRevision(), UserrightsPage\saveUserGroups(), UserMailer\send(), UserMailer\sendInternal(), UserMailer\sendWithPear(), User\setEmailWithConfirmation(), ContentModelChange\setTags(), WikiImporter\setTargetRootPage(), PostgresInstaller\setupDatabase(), SqliteInstaller\setupDatabase(), PostgresInstaller\setupPLpgSQL(), PostgresInstaller\setupSchema(), MysqlInstaller\setupUser(), PostgresInstaller\setupUser(), RevDelList\setVisibility(), MediaWiki\Watchlist\WatchlistManager\setWatch(), SpecialUploadStash\showUploads(), LocalRepo\skipWriteOperationIfSha1(), MediaTransformOutput\streamFileWithStatus(), SpecialEmailUser\submit(), MysqlInstaller\submitConnectForm(), PostgresInstaller\submitConnectForm(), MediaWiki\Preferences\DefaultPreferencesFactory\submitForm(), DatabaseInstaller\submitInstallUserBox(), SpecialConfirmEmail\submitSend(), DatabaseInstaller\submitSettingsForm(), MysqlInstaller\submitSettingsForm(), PostgresInstaller\submitSettingsForm(), DatabaseInstaller\submitWebUserBox(), Installer\subscribeToMediaWikiAnnounce(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\testForAccountCreation(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\testForAccountCreation(), MediaWiki\Auth\CheckBlocksSecondaryAuthenticationProvider\testUserForCreation(), UploadBase\tryStashFile(), HTMLForm\trySubmit(), AuthManagerSpecialPage\trySubmit(), MediaWiki\Block\UnblockUser\unblock(), MediaWiki\Block\UnblockUser\unblockUnsafe(), Page\UndeletePage\undeleteRevisions(), Page\UndeletePage\undeleteUnsafe(), RevDelItem\unlock(), MediaWiki\User\BotPasswordStore\updateBotPassword(), ChangeTagsLogList\updateChangeTagsOnAll(), ChangeTagsRevisionList\updateChangeTagsOnAll(), MediaWiki\Storage\PageUpdater\updateRevision(), ChangeTags\updateTagsWithChecks(), HTMLRestrictionsField\validate(), MediaWiki\User\BotPasswordStore\validateBotPassword(), MediaWiki\Block\BlockUtils\validateIPv4Range(), MediaWiki\Block\BlockUtils\validateIPv6Range(), ContentHandler\validateSave(), MediaWiki\Block\BlockUtils\validateTarget(), MediaHandler\verifyUpload(), and PoolCounterRedis\waitForSlotOrNotif().

◆ replaceMessage()

StatusValue::replaceMessage (   $source,
  $dest 
)

If the specified source message exists, replace it with the specified destination message, but keep the same parameters as in the original error.

Note, due to the lack of tools for comparing IStatusMessage objects, this function will not work when using such an object as the search parameter.

Parameters
MessageSpecifier | string$sourceMessage key or object to search for
MessageSpecifier | string$destReplacement message key or object
Returns
bool Return true if the replacement was done, false otherwise.

Definition at line 347 of file StatusValue.php.

References $source.

Referenced by ApiBase\addBlockInfoToStatus().

◆ setOK()

StatusValue::setOK (   $ok)

Change operation status.

Parameters
bool$ok
Returns
$this

Definition at line 159 of file StatusValue.php.

References $ok.

Referenced by Status\__set(), and ApiBase\dieStatus().

◆ setResult()

StatusValue::setResult (   $ok,
  $value = null 
)

Change operation result.

Parameters
bool$okWhether the operation completed
mixed | null$value
Returns
$this

Definition at line 171 of file StatusValue.php.

References $ok, and $value.

◆ splitByErrorType()

StatusValue::splitByErrorType ( )

Splits this StatusValue object into two new StatusValue objects, one which contains only the error messages, and one that contains the warnings, only.

The returned array is defined as: [ 0 => object(StatusValue) # the StatusValue with error messages, only 1 => object(StatusValue) # The StatusValue with warning messages, only ]

Returns
static[]

Reimplemented in Status.

Definition at line 99 of file StatusValue.php.

References getValue(), and isOK().

◆ warning()

StatusValue::warning (   $message,
  $parameters 
)

Add a new warning.

Parameters
string | MessageSpecifier$messageMessage key or object
mixed...$parameters
Returns
$this

Definition at line 234 of file StatusValue.php.

References addError().

Referenced by MediaWiki\Storage\PageUpdater\doModify().

Member Data Documentation

◆ $errors

array [] StatusValue::$errors = []
protected

Definition at line 49 of file StatusValue.php.

Referenced by Status\getErrorMessageArray(), getErrors(), Status\getWikiText(), and isGood().

◆ $failCount

int StatusValue::$failCount = 0

Counter for batch operations.

Definition at line 61 of file StatusValue.php.

◆ $ok

bool StatusValue::$ok = true
protected

Definition at line 46 of file StatusValue.php.

Referenced by isOK(), setOK(), and setResult().

◆ $success

bool [] StatusValue::$success = []

Map of (key => bool) to indicate success of each part of batch operations.

Definition at line 55 of file StatusValue.php.

◆ $successCount

int StatusValue::$successCount = 0

Counter for batch operations.

Definition at line 58 of file StatusValue.php.

◆ $value

mixed StatusValue::$value

Definition at line 52 of file StatusValue.php.

Referenced by Status\__set(), getValue(), newGood(), and setResult().


The documentation for this class was generated from the following file: