MediaWiki  REL1_31
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)
 Add an error, do not set fatal flag This can be used for non-fatal errors. More...
 
 fatal ( $message)
 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)
 Add a new warning. More...
 

Static Public Member Functions

static newFatal ( $message)
 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 Attributes

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

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.

Since
1.25

Definition at line 42 of file StatusValue.php.

Member Function Documentation

◆ __toString()

StatusValue::__toString ( )
Returns
string

Definition at line 302 of file StatusValue.php.

References $out, $params, as, errors, and isOK().

◆ error()

StatusValue::error (   $message)

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

Parameters
string | MessageSpecifier$messageMessage key or object

Definition at line 191 of file StatusValue.php.

References errors.

◆ fatal()

StatusValue::fatal (   $message)

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

Parameters
string | MessageSpecifier$messageMessage key or object

Definition at line 205 of file StatusValue.php.

References errors.

Referenced by Status\getMessage(), and Status\getWikiText().

◆ getErrors()

StatusValue::getErrors ( )

Get the list of errors.

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

Returns
array[]

Definition at line 148 of file StatusValue.php.

References $errors.

Referenced by Status\__get(), Status\getMessage(), Status\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 240 of file StatusValue.php.

References $type, as, and errors.

◆ getValue()

StatusValue::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 258 of file StatusValue.php.

References as, and errors.

◆ isGood()

StatusValue::isGood ( )

Returns whether the operation completed and didn't have any error or warnings.

Returns
bool

Definition at line 121 of file StatusValue.php.

References $errors.

Referenced by SpecialEmailUser\execute(), and HTMLForm\show().

◆ isOK()

StatusValue::isOK ( )

Returns whether the operation completed.

Returns
bool

Definition at line 130 of file StatusValue.php.

References $ok.

Referenced by Status\__get(), __toString(), Status\getMessage(), and Status\getWikiText().

◆ merge()

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

Merge another status object into this one.

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

Definition at line 220 of file StatusValue.php.

References errors.

◆ newFatal()

static StatusValue::newFatal (   $message)
static

Factory function for fatal errors.

Parameters
string | MessageSpecifier$messageMessage key or object
Returns
static

Definition at line 68 of file StatusValue.php.

References $params.

Referenced by MWHttpRequest\__construct(), UploadFromChunks\addChunk(), User\addToDatabase(), 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(), ImportReporter\close(), UploadBase\convertVerifyErrorToStatus(), Installer\createSysop(), SqliteInstaller\dataDirOKmaybeCreate(), ApiDelete\delete(), ApiDelete\deleteFile(), SpecialRedirect\dispatchFile(), SpecialRedirect\dispatchLog(), SpecialRedirect\dispatchPage(), SpecialRedirect\dispatchRevision(), SpecialRedirect\dispatchUser(), FileDeleteForm\doDelete(), WikiPage\doEditContent(), Installer\doEnvironmentChecks(), SpecialImport\doImport(), WatchAction\doUnwatch(), WikiPage\doUpdateRestrictions(), WatchAction\doWatch(), PoolCounterWork\execute(), LoginSignupSpecialPage\execute(), SpecialChangeCredentials\execute(), SpecialLinkAccounts\execute(), SpecialUnlinkAccounts\execute(), ApiEmailUser\execute(), ApiImageRotate\execute(), CliInstaller\execute(), ZipDirectoryReader\execute(), PasswordReset\execute(), UploadFromUrl\fetchFile(), UserrightsPage\fetchUser(), PoolCounterRedis\getConnection(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\getPasswordResetData(), WebInstallerExistingWiki\handleExistingUpgrade(), ApiUpload\handleStashException(), PasswordReset\isAllowed(), ChangeTags\isTagNameValid(), ApiAuthManagerHelper\logAuthenticationResult(), BotPassword\login(), MediaWiki\Auth\LegacyHookPreAuthenticationProvider\makeFailResponse(), SqliteInstaller\makeStubDBFile(), DatabaseInstaller\meetsMinimumRequirement(), User\newFatalPermissionDeniedStatus(), ImportStreamSource\newFromFile(), ImportStreamSource\newFromInterwiki(), ImportStreamSource\newFromUpload(), ImportStreamSource\newFromURL(), ApiUsageException\newWithMessage(), RevertAction\onSubmit(), SpecialChangeContentModel\onSubmit(), SpecialLockdb\onSubmit(), SpecialPageLanguage\onSubmit(), SpecialRandomInCategory\onSubmit(), SpecialUnlockdb\onSubmit(), SpecialExpandTemplates\onSubmitInput(), FormatJson\parse(), ApiUpload\performStash(), DatabaseInstaller\populateInterwikiTable(), MediaWiki\Auth\UserDataAuthenticationRequest\populateUser(), FileOp\precheck(), PoolCounter\precheckAcquire(), AbstractContent\prepareSave(), MediaWiki\Auth\AuthManagerTest\provideAccountCreation(), MediaWiki\Auth\AuthManagerTest\provideAccountLink(), MediaWiki\Auth\AuthManagerTest\provideAllowsAuthenticationDataChange(), MediaWiki\Auth\AuthManagerTest\provideAuthentication(), ApiMainTest\provideExceptionErrors(), ApiBaseTest\provideGetParameterFromSettings(), MediaWiki\Auth\UserDataAuthenticationRequestTest\providePopulateUser(), MediaWiki\Auth\AuthPluginPrimaryAuthenticationProviderTest\provideProviderAllowsAuthenticationDataChange(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\provideProviderAllowsAuthenticationDataChange(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\provideProviderAllowsAuthenticationDataChange(), MediaWiki\Auth\LegacyHookPreAuthenticationProviderTest\provideTestForAccountCreation(), UploadFromUrl\reallyFetchFile(), LocalFile\recordUpload2(), PoolCounterRedis\release(), LocalFileDeleteBatch\removeNonexistentFiles(), LocalFileRestoreBatch\removeNonexistentFiles(), LocalFileMoveBatch\removeNonexistentFiles(), ChangeTags\restrictedTagError(), AssembleUploadChunksJob\run(), PublishStashedFileJob\run(), BotPassword\save(), SpecialBotPasswords\save(), MediaWiki\Preferences\DefaultPreferencesFactory\saveFormData(), UserrightsPage\saveUserGroups(), UserMailer\send(), UserMailer\sendInternal(), UserMailer\sendWithPear(), User\setEmailWithConfirmation(), SqliteInstaller\setupDatabase(), PostgresInstaller\setupPLpgSQL(), PostgresInstaller\setupSchema(), PostgresInstaller\setupUser(), RevDelList\setVisibility(), MediaTransformOutput\streamFileWithStatus(), WebInstallerDBConnect\submit(), SpecialEditTags\submit(), SpecialEmailUser\submit(), EmailConfirmation\submitSend(), MssqlInstaller\submitSettingsForm(), MysqlInstaller\submitSettingsForm(), PostgresInstaller\submitSettingsForm(), DatabaseInstaller\submitWebUserBox(), SpecialLinkAccounts\success(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testAccountCreationEmail(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testAuthentication(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testAuthentication(), MediaWiki\Auth\AuthManagerTest\testAutoAccountCreation(), MediaWiki\Auth\AuthManagerTest\testAutoCreateFailOnLogin(), MediaWiki\Sparql\SparqlClientTest\testBadQuery(), MediaWiki\Auth\AuthManagerTest\testBeginAccountCreation(), MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProviderTest\testBeginLinkAttempt(), MediaWiki\Auth\EmailNotificationSecondaryAuthenticationProviderTest\testBeginSecondaryAccountCreation(), MediaWiki\Auth\AuthManagerTest\testCanCreateAccount(), MediaWiki\Auth\AuthManagerTest\testCheckAccountCreatePermissions(), MediaWiki\Auth\AuthManagerTest\testContinueAccountCreation(), MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProviderTest\testContinueLinkAttempt(), UploadStashTest\testExceptionWhenStoreTempFails(), MediaWiki\Auth\LegacyHookPreAuthenticationProvider\testForAccountCreation(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\testForAccountCreation(), MediaWiki\Auth\AuthManagerTest\testGetAuthenticationRequests(), PasswordResetTest\testIsAllowed(), BotPasswordTest\testLogin(), StatusTest\testNewFatalWithMessage(), StatusTest\testNewFatalWithString(), StatusTest\testOkAndErrorsGetters(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testProviderAllowsAuthenticationDataChange(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testProviderChangeAuthenticationDataEmail(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testTestForAccountCreation(), MediaWiki\Auth\ResetPasswordSecondaryAuthenticationProviderTest\testTryReset(), MediaWiki\Auth\CheckBlocksSecondaryAuthenticationProvider\testUserForCreation(), SpecialUploadStash\tryClearStashedUploads(), UploadBase\tryStashFile(), UploadFromChunks\tryStashFile(), AuthManagerSpecialPage\trySubmit(), PageArchive\undeleteRevisions(), ChangeTags\updateTagsWithChecks(), and PoolCounterRedis\waitForSlotOrNotif().

◆ newGood()

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

Factory function for good results.

Parameters
mixed$value
Returns
static

Definition at line 81 of file StatusValue.php.

References $value.

Referenced by MWHttpRequest\__construct(), PoolCounter_Stub\acquireForAnyone(), PoolCounter_Stub\acquireForMe(), RevDelList\acquireItemLocks(), ChangeTags\activateTagWithChecks(), ChangeTags\addTagsAccompanyingChangeWithChecks(), User\addToDatabase(), 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(), PasswordPolicyChecks\checkMaximalPasswordLength(), PasswordPolicyChecks\checkMinimalPasswordLength(), PasswordPolicyChecks\checkMinimumPasswordLengthToLogin(), PasswordPolicyChecks\checkPasswordCannotMatchBlacklist(), PasswordPolicyChecks\checkPasswordCannotMatchUsername(), User\checkPasswordValidity(), UserPasswordPolicy\checkPolicies(), PasswordPolicyChecks\checkPopularPasswordBlacklist(), DatabaseInstaller\checkPrerequisites(), LocalRepo\cleanupDeletedBatch(), ImportReporter\close(), FSLockManager\closeLockHandles(), QuorumLockManager\collectPledgeQuorum(), PostgresInstaller\commitChanges(), MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProvider\continueLinkAttempt(), Installer\createMainpage(), Installer\createSysop(), ChangeTags\createTagWithChecks(), SqliteInstaller\dataDirOKmaybeCreate(), ChangeTags\deactivateTagWithChecks(), ChangeTags\deleteTagEverywhere(), 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(), WikiPage\doCreate(), WikiPage\doDeleteArticleReal(), WikiPage\doEditContent(), Installer\doEnvironmentChecks(), Installer\doGenerateKeys(), MySqlLockManager\doGetLocksOnServer(), PostgreSqlLockManager\doGetLocksOnServer(), FSLockManager\doLock(), NullLockManager\doLock(), LockManager\doLockByType(), QuorumLockManager\doLockByType(), DBFileJournal\doLogChangeBatch(), NullFileJournal\doLogChangeBatch(), WikiPage\doModify(), OracleInstaller\doOpenConnection(), 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(), DBFileJournal\doPurgeOldLogs(), NullFileJournal\doPurgeOldLogs(), FSLockManager\doSingleLock(), FSLockManager\doSingleUnlock(), FileBackendTest\doTestLockCalls(), FSLockManager\doUnlock(), NullLockManager\doUnlock(), LockManager\doUnlockByType(), QuorumLockManager\doUnlockByType(), WatchAction\doUnwatch(), WikiPage\doUpdateRestrictions(), WatchAction\doWatch(), WatchAction\doWatchOrUnwatch(), ApiBase\errorArrayToStatus(), SpecialUnlinkAccounts\execute(), ZipDirectoryReader\execute(), PasswordReset\execute(), UploadBase\fetchFile(), UserrightsPage\fetchUser(), DBLockManager\freeLocksOnServer(), MemcLockManager\freeLocksOnServer(), RedisLockManager\freeLocksOnServer(), ApiUpload\getChunkResult(), DatabaseInstaller\getConnection(), PoolCounterRedis\getConnection(), DBLockManager\getLocksOnServer(), MemcLockManager\getLocksOnServer(), RedisLockManager\getLocksOnServer(), PostgresInstaller\getPgConnection(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\getProvider(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\getProvider(), MediaWiki\Sparql\SparqlClientTest\getRequestMock(), AuthManagerSpecialPage\handleFormSubmit(), SpecialChangeCredentials\handleFormSubmit(), SpecialUnlinkAccounts\handleFormSubmit(), WebInstallerExistingWiki\importVariables(), Installer\includeExtensions(), EditPage\internalAttemptSave(), PasswordReset\isAllowed(), ChangeTags\isTagNameValid(), RevDelItem\lock(), ApiAuthManagerHelper\logAuthenticationResult(), FileJournal\logChangeBatch(), BotPassword\login(), LoginSignupSpecialPage\mainLoginForm(), MediaWiki\Auth\LegacyHookPreAuthenticationProvider\makeFailResponse(), SqliteInstaller\makeStubDBFile(), DatabaseInstaller\meetsMinimumRequirement(), MovePage\move(), ImportStreamSource\newFromFile(), ImportStreamSource\newFromURL(), FileRepo\newGood(), FileBackend\newStatus(), SpecialBotPasswords\onSubmit(), SpecialLockdb\onSubmit(), SpecialUnlockdb\onSubmit(), SpecialExpandTemplates\onSubmitInput(), MssqlInstaller\openConnection(), MysqlInstaller\openConnection(), SqliteInstaller\openConnection(), PostgresInstaller\openConnectionToAnyDB(), PostgresInstaller\openConnectionWithParams(), FormatJson\parse(), ApiUpload\performUpload(), DatabaseInstaller\populateInterwikiTable(), Installer\populateSiteStats(), MediaWiki\Auth\UserDataAuthenticationRequest\populateUser(), PoolCounter\precheckAcquire(), FileOp\precheckDestExistence(), AbstractContent\prepareSave(), MediaWiki\Auth\AuthManagerTest\provideAccountCreation(), MediaWiki\Auth\AuthManagerTest\provideAccountLink(), MediaWiki\Auth\AuthManagerTest\provideAllowsAuthenticationDataChange(), MediaWiki\Auth\AuthManagerTest\provideAuthentication(), MWRestrictionsTest\provideCheck(), MediaWiki\Auth\UserDataAuthenticationRequestTest\providePopulateUser(), MediaWiki\Auth\AuthPluginPrimaryAuthenticationProviderTest\provideProviderAllowsAuthenticationDataChange(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\provideProviderAllowsAuthenticationDataChange(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\provideProviderAllowsAuthenticationDataChange(), MediaWiki\Auth\AuthPluginPrimaryAuthenticationProvider\providerAllowsAuthenticationDataChange(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\providerAllowsAuthenticationDataChange(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\providerAllowsAuthenticationDataChange(), MediaWiki\Auth\LegacyHookPreAuthenticationProviderTest\provideTestForAccountCreation(), FSLockManager\pruneKeyLockFiles(), LocalFile\recordUpload2(), PoolCounter_Stub\release(), PoolCounterRedis\release(), MySqlLockManager\releaseAllLocks(), MemcLockManager\releaseAllLocks(), PostgreSqlLockManager\releaseAllLocks(), RedisLockManager\releaseAllLocks(), RevDelList\releaseItemLocks(), QuorumLockManager\releasePledges(), LocalFileDeleteBatch\removeNonexistentFiles(), LocalFileRestoreBatch\removeNonexistentFiles(), LocalFileMoveBatch\removeNonexistentFiles(), AssembleUploadChunksJob\run(), PublishStashedFileJob\run(), ApiQueryRevisions\run(), BotPassword\save(), UserrightsPage\saveUserGroups(), SearchEngine\searchArchiveTitle(), UserMailer\send(), UserMailer\sendInternal(), UserMailer\sendWithPear(), User\setEmailWithConfirmation(), WikiImporter\setTargetRootPage(), OracleInstaller\setupDatabase(), PostgresInstaller\setupDatabase(), SqliteInstaller\setupDatabase(), PostgresInstaller\setupPLpgSQL(), PostgresInstaller\setupSchema(), MssqlInstaller\setupUser(), MysqlInstaller\setupUser(), OracleInstaller\setupUser(), PostgresInstaller\setupUser(), RevDelList\setVisibility(), LocalRepo\skipWriteOperationIfSha1(), MediaTransformOutput\streamFileWithStatus(), SpecialEmailUser\submit(), MssqlInstaller\submitConnectForm(), MysqlInstaller\submitConnectForm(), OracleInstaller\submitConnectForm(), PostgresInstaller\submitConnectForm(), MediaWiki\Preferences\DefaultPreferencesFactory\submitForm(), DatabaseInstaller\submitInstallUserBox(), OracleInstaller\submitInstallUserBox(), EmailConfirmation\submitSend(), DatabaseInstaller\submitSettingsForm(), MssqlInstaller\submitSettingsForm(), MysqlInstaller\submitSettingsForm(), PostgresInstaller\submitSettingsForm(), DatabaseInstaller\submitWebUserBox(), SyncFileBackend\syncFileBatch(), MediaWiki\Auth\AbstractPreAuthenticationProviderTest\testAbstractPreAuthenticationProvider(), MediaWiki\Auth\AbstractPrimaryAuthenticationProviderTest\testAbstractPrimaryAuthenticationProvider(), MediaWiki\Auth\AbstractSecondaryAuthenticationProviderTest\testAbstractSecondaryAuthenticationProvider(), MediaWiki\Auth\AuthManagerTest\testAccountCreation(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testAccountCreationEmail(), MediaWiki\Auth\AuthManagerTest\testAccountCreationLogging(), MediaWiki\Auth\AuthManagerTest\testAccountLink(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testAuthentication(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testAuthentication(), MediaWiki\Auth\AuthManagerTest\testAuthentication(), MediaWiki\Auth\AuthManagerTest\testAutoAccountCreation(), MediaWiki\Auth\AuthManagerTest\testAutoCreateOnLogin(), MediaWiki\Auth\AuthManagerTest\testBeginAccountCreation(), MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProviderTest\testBeginLinkAttempt(), MediaWiki\Auth\EmailNotificationSecondaryAuthenticationProviderTest\testBeginSecondaryAccountCreation(), MediaWiki\Auth\AuthManagerTest\testCanCreateAccount(), MediaWiki\Auth\AuthManagerTest\testCheckAccountCreatePermissions(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProviderTest\testCheckPasswordValidity(), MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProviderTest\testContinueLinkAttempt(), ApiBaseTest\testDieStatus(), MediaWiki\Auth\ThrottlePreAuthenticationProviderTest\testDisabled(), ApiBaseTest\testErrorArrayToStatus(), ApiErrorFormatterTest\testErrorFormatter(), ApiErrorFormatterTest\testErrorFormatterBasics(), ApiErrorFormatterTest\testErrorFormatterBC(), PasswordResetTest\testExecute_email(), MediaWiki\Auth\LegacyHookPreAuthenticationProvider\testForAccountCreation(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\testForAccountCreation(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\testForAccountCreation(), MediaWiki\Auth\LegacyHookPreAuthenticationProvider\testForAuthentication(), MediaWiki\Auth\AuthManagerTest\testGetAuthenticationRequests(), MediaWiki\Auth\AuthManagerTest\testGetAuthenticationRequestsRequired(), StatusTest\testGetErrorsWarningsOnlyStatus(), PasswordResetTest\testIsAllowed(), StatusTest\testNewGood(), StatusTest\testOkAndErrorsGetters(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testProviderAllowsAuthenticationDataChange(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testProviderChangeAuthenticationDataEmail(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProviderTest\testSetPasswordResetFlag(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testSetPasswordResetFlag(), MediaWiki\Auth\AuthPluginPrimaryAuthenticationProviderTest\testTestForAccountCreation(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testTestForAccountCreation(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testTestForAccountCreation(), MediaWiki\Auth\LegacyHookPreAuthenticationProviderTest\testTestForAuthentication(), MediaWiki\Auth\LegacyHookPreAuthenticationProviderTest\testTestUserForCreation(), MediaWiki\Auth\CheckBlocksSecondaryAuthenticationProviderTest\testTestUserForCreation(), MediaWiki\Auth\ResetPasswordSecondaryAuthenticationProviderTest\testTryReset(), MediaWiki\Auth\CheckBlocksSecondaryAuthenticationProvider\testUserForCreation(), MediaWiki\Auth\LegacyHookPreAuthenticationProvider\testUserForCreation(), SpecialUploadStash\tryClearStashedUploads(), UploadBase\tryStashFile(), HTMLForm\trySubmit(), AuthManagerSpecialPage\trySubmit(), PageArchive\undeleteRevisions(), RevDelItem\unlock(), ChangeTags\updateTagsWithChecks(), HTMLRestrictionsField\validate(), SpecialBlock\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 286 of file StatusValue.php.

References $source, as, and errors.

◆ setOK()

StatusValue::setOK (   $ok)

Change operation status.

Parameters
bool$ok

Definition at line 157 of file StatusValue.php.

References $ok.

Referenced by Status\__set().

◆ setResult()

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

Change operation result.

Parameters
bool$okWhether the operation completed
mixed$value

Definition at line 167 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
StatusValue[]

Reimplemented in Status.

Definition at line 98 of file StatusValue.php.

References as, and errors.

◆ warning()

StatusValue::warning (   $message)

Add a new warning.

Parameters
string | MessageSpecifier$messageMessage key or object

Definition at line 177 of file StatusValue.php.

References errors.

Member Data Documentation

◆ $errors

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

Definition at line 48 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 60 of file StatusValue.php.

◆ $ok

bool StatusValue::$ok = true
protected

Definition at line 45 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 54 of file StatusValue.php.

◆ $successCount

int StatusValue::$successCount = 0

Counter for batch operations.

Definition at line 57 of file StatusValue.php.

◆ $value

mixed StatusValue::$value

Definition at line 51 of file StatusValue.php.

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


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