MediaWiki  REL1_19
Status Class Reference

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

Inheritance diagram for Status:

List of all members.

Public Member Functions

 __wakeup ()
 Sanitize the callback parameter on wakeup, to avoid arbitrary execution.
 error ($message)
 Add an error, do not set fatal flag This can be used for non-fatal errors.
 fatal ($message)
 Add an error and set OK to false, indicating that the operation as a whole was fatal.
 getErrorsArray ()
 Get the list of errors (but not warnings)
 getErrorsByType ($type)
 Returns a list of status messages of the given type, with message and params left untouched, like a sane version of getStatusArray.
 getMessage ()
 Backward compatibility function for WikiError -> Status migration.
 getWarningsArray ()
 Get the list of warnings (but not errors)
 getWikiText ($shortContext=false, $longContext=false)
 Get the error list as a wikitext formatted list.
 getWikiTextArray ($errors)
 Return an array with the wikitext for each item in the array.
 getXML ()
 Get the error list as XML.
 hasMessage ($msg)
 Returns true if the specified message is present as a warning or error.
 isGood ()
 Returns whether the operation completed and didn't have any error or warnings.
 isOK ()
 Returns whether the operation completed.
 merge ($other, $overwriteValue=false)
 Merge another status object into this one.
 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.
 setResult ($ok, $value=null)
 Change operation result.
 warning ($message)
 Add a new warning.

Static Public Member Functions

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

Public Attributes

 $cleanCallback = false
 $errors = array()
 $failCount = 0
 $ok = true
 $success = array()
 Array to indicate which items of the batch operations were successful.
 $successCount = 0
 Counters for batch operations.
 $value

Protected Member Functions

 cleanParams ($params)
 getItemXML ($item)
 getStatusArray ($type)
 Returns a list of status messages of the given type.
 getWikiTextForError ($error)
 Return the wiki text for a single error.

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.

Definition at line 15 of file Status.php.


Member Function Documentation

Sanitize the callback parameter on wakeup, to avoid arbitrary execution.

Definition at line 126 of file Status.php.

Status::cleanParams ( params) [protected]
Parameters:
$paramsarray
Returns:
array

Definition at line 134 of file Status.php.

Referenced by getItemXML(), and getWikiTextForError().

Here is the caller graph for this function:

Status::error ( message)

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

Parameters:
$messageString: message name

Definition at line 100 of file Status.php.

Status::fatal ( message)

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

Parameters:
$messageString: message name

Definition at line 114 of file Status.php.

Referenced by getWikiText().

Here is the caller graph for this function:

Get the list of errors (but not warnings)

Returns:
Array

Definition at line 265 of file Status.php.

References getStatusArray().

Referenced by CliInstaller\showStatusMessage(), and WebInstaller\showStatusMessage().

Here is the call graph for this function:

Here is the caller graph for this function:

Returns a list of status messages of the given type, with message and params left untouched, like a sane version of getStatusArray.

Parameters:
$typeString
Returns:
Array

Definition at line 306 of file Status.php.

References $result.

Status::getItemXML ( item) [protected]
Parameters:
$item
Returns:
string

Definition at line 149 of file Status.php.

References cleanParams(), Xml\element(), and wfMsg().

Referenced by getXML().

Here is the call graph for this function:

Here is the caller graph for this function:

Backward compatibility function for WikiError -> Status migration.

Returns:
String

Definition at line 355 of file Status.php.

References getWikiText().

Here is the call graph for this function:

Status::getStatusArray ( type) [protected]

Returns a list of status messages of the given type.

Parameters:
$typeString
Returns:
Array

Definition at line 284 of file Status.php.

References $result.

Referenced by getErrorsArray(), and getWarningsArray().

Here is the caller graph for this function:

Get the list of warnings (but not errors)

Returns:
Array

Definition at line 274 of file Status.php.

References getStatusArray().

Referenced by CliInstaller\showStatusMessage(), and WebInstaller\showStatusMessage().

Here is the call graph for this function:

Here is the caller graph for this function:

Status::getWikiText ( shortContext = false,
longContext = false 
)

Get the error list as a wikitext formatted list.

Parameters:
$shortContextString: a short enclosing context message name, to be used when there is a single error
$longContextString: a long enclosing context message name, for a list
Returns:
String

Definition at line 182 of file Status.php.

References fatal(), getWikiTextArray(), getWikiTextForError(), and wfMsgNoTrans().

Referenced by getMessage().

Here is the call graph for this function:

Here is the caller graph for this function:

Status::getWikiTextArray ( errors)

Return an array with the wikitext for each item in the array.

Parameters:
$errorsArray
Returns:
Array

Definition at line 240 of file Status.php.

References $errors.

Referenced by getWikiText().

Here is the caller graph for this function:

Status::getWikiTextForError ( error) [protected]

Return the wiki text for a single error.

Parameters:
$errorMixed With an array & two values keyed by 'message' and 'params', use those keys-value pairs. Otherwise, if its an array, just use the first value as the message and the remaining items as the params.
Returns:
String

Definition at line 220 of file Status.php.

References cleanParams(), and wfMsgNoTrans().

Referenced by getWikiText().

Here is the call graph for this function:

Here is the caller graph for this function:

Get the error list as XML.

Returns:
string

Definition at line 165 of file Status.php.

References getItemXML().

Here is the call graph for this function:

Status::hasMessage ( msg)

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

Parameters:
$msgString: message name
Returns:
Boolean

Definition at line 322 of file Status.php.

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

Returns:
Boolean

Definition at line 68 of file Status.php.

Returns whether the operation completed.

Returns:
Boolean

Definition at line 77 of file Status.php.

Status::merge ( other,
overwriteValue = false 
)

Merge another status object into this one.

Parameters:
$otherStatus Other Status object
$overwriteValueBoolean: whether to override the "value" member

Definition at line 250 of file Status.php.

Referenced by ScopedLock\factory().

Here is the caller graph for this function:

static Status::newFatal ( message) [static]

Factory function for fatal errors.

Parameters:
$messageString: message name

Reimplemented in FileRepoStatus.

Definition at line 32 of file Status.php.

References $result.

Referenced by MWHttpRequest\__construct(), UploadFromChunks\addChunk(), FileOp\attempt(), FileBackend\clean(), ImportReporter\close(), UploadBase\convertVerifyErrorToStatus(), FileBackendStore\createInternal(), Installer\createSysop(), SqliteInstaller\dataDirOKmaybeCreate(), FileDeleteForm\doDelete(), Installer\doEnvironmentChecks(), SpecialImport\doImport(), FileBackend\doOperations(), WikiPage\doUpdateRestrictions(), CliInstaller\execute(), ZipDirectoryReader\execute(), PoolCounterWork\execute(), UploadFromUrl\fetchFile(), UserrightsPage\fetchUser(), WebInstaller_ExistingWiki\handleExistingUpgrade(), LoginForm\mailPasswordInternal(), ImportStreamSource\newFromFile(), ImportStreamSource\newFromInterwiki(), ImportStreamSource\newFromUpload(), ImportStreamSource\newFromURL(), SpecialUnlockdb\onSubmit(), SpecialLockdb\onSubmit(), UploadFromUrl\performUpload(), DatabaseInstaller\populateInterwikiTable(), FileOp\precheck(), FileBackend\prepare(), UploadFromUrl\reallyFetchFile(), FileBackend\secure(), UserMailer\send(), UserMailer\sendWithPear(), SqliteInstaller\setupDatabase(), PostgresInstaller\setupPLpgSQL(), PostgresInstaller\setupSchema(), PostgresInstaller\setupUser(), FileBackendStore\storeInternal(), WebInstaller_DBConnect\submit(), PostgresInstaller\submitConnectForm(), OracleInstaller\submitConnectForm(), MysqlInstaller\submitConnectForm(), PostgresInstaller\submitSettingsForm(), MysqlInstaller\submitSettingsForm(), DatabaseInstaller\submitWebUserBox(), and SpecialUploadStash\tryClearStashedUploads().

Here is the caller graph for this function:

static Status::newGood ( value = null) [static]

Factory function for good results.

Parameters:
$valueMixed

Definition at line 45 of file Status.php.

References $result, and $value.

Referenced by MWHttpRequest\__construct(), PoolCounter_Stub\acquireForAnyone(), PoolCounter_Stub\acquireForMe(), SwiftFileBackend\addMissingMetadata(), FileOp\attemptBatch(), SqliteInstaller\checkPrerequisites(), DatabaseInstaller\checkPrerequisites(), ImportReporter\close(), FSLockManager\closeLockHandles(), PostgresInstaller\commitChanges(), FileBackendStore\concatenate(), FileBackendMultiWrite\consistencyCheck(), Installer\createMainpage(), Installer\createSysop(), SqliteInstaller\dataDirOKmaybeCreate(), FileOp\doAttempt(), StoreFileOp\doAttempt(), CreateFileOp\doAttempt(), CopyFileOp\doAttempt(), MoveFileOp\doAttempt(), DeleteFileOp\doAttempt(), FileBackendMultiWrite\doClean(), FileBackendStore\doClean(), FSFileBackend\doCleanInternal(), SwiftFileBackend\doCleanInternal(), FileBackendStore\doCleanInternal(), FileBackendStore\doConcatenate(), FSFileBackend\doCopyInternal(), SwiftFileBackend\doCopyInternal(), SwiftFileBackend\doCreateInternal(), FSFileBackend\doCreateInternal(), FSFileBackend\doDeleteInternal(), SwiftFileBackend\doDeleteInternal(), WikiPage\doEdit(), Installer\doEnvironmentChecks(), Installer\doGenerateKeys(), FSLockManager\doLock(), LSLockManager\doLock(), DBLockManager\doLock(), NullLockManager\doLock(), FSFileBackend\doMoveInternal(), FileBackendMultiWrite\doOperationsInternal(), FileBackendStore\doOperationsInternal(), RevDel_RevisionList\doPostCommitUpdates(), RevDel_List\doPostCommitUpdates(), RevDel_ArchiveList\doPostCommitUpdates(), RevDel_FileList\doPostCommitUpdates(), FileOp\doPrecheck(), StoreFileOp\doPrecheck(), CreateFileOp\doPrecheck(), CopyFileOp\doPrecheck(), MoveFileOp\doPrecheck(), DeleteFileOp\doPrecheck(), RevDel_RevisionList\doPreCommitUpdates(), RevDel_List\doPreCommitUpdates(), RevDel_ArchiveList\doPreCommitUpdates(), RevDel_FileList\doPreCommitUpdates(), FileBackendMultiWrite\doPrepare(), FileBackendStore\doPrepare(), SwiftFileBackend\doPrepareInternal(), FSFileBackend\doPrepareInternal(), FileBackendStore\doPrepareInternal(), FileBackendMultiWrite\doSecure(), FileBackendStore\doSecure(), FSFileBackend\doSecureInternal(), SwiftFileBackend\doSecureInternal(), FileBackendStore\doSecureInternal(), FSLockManager\doSingleLock(), FSLockManager\doSingleUnlock(), FSFileBackend\doStoreInternal(), SwiftFileBackend\doStoreInternal(), SwiftFileBackend\doStreamFile(), FileBackendStore\doStreamFile(), FSLockManager\doUnlock(), LSLockManager\doUnlock(), DBLockManager\doUnlock(), NullLockManager\doUnlock(), WikiPage\doUpdateRestrictions(), ZipDirectoryReader\execute(), UploadFromUrl\fetchFile(), UploadBase\fetchFile(), UserrightsPage\fetchUser(), DBLockManager\finishLockTransactions(), DatabaseInstaller\getConnection(), PostgresInstaller\getPgConnection(), WebInstaller_ExistingWiki\importVariables(), Installer\includeExtensions(), EditPage\internalAttemptSave(), ImportStreamSource\newFromFile(), ImportStreamSource\newFromURL(), SpecialUnlockdb\onSubmit(), SpecialLockdb\onSubmit(), Ibm_db2Installer\openConnection(), MysqlInstaller\openConnection(), OracleInstaller\openConnection(), SqliteInstaller\openConnection(), PostgresInstaller\openConnectionToAnyDB(), PostgresInstaller\openConnectionWithParams(), OracleInstaller\openSYSDBAConnection(), DatabaseInstaller\populateInterwikiTable(), Installer\populateSiteStats(), FileOp\precheckDestExistence(), FSLockManager\pruneKeyLockFiles(), PoolCounter_Stub\release(), LSLockManager\releaseLocks(), UserMailer\send(), UserMailer\sendWithPear(), OracleInstaller\setupDatabase(), PostgresInstaller\setupDatabase(), PostgresInstaller\setupPLpgSQL(), PostgresInstaller\setupSchema(), OracleInstaller\setupUser(), MysqlInstaller\setupUser(), PostgresInstaller\setupUser(), RevDel_List\setVisibility(), SpecialUploadStash\showUploads(), FileBackendStore\streamFile(), PostgresInstaller\submitConnectForm(), OracleInstaller\submitConnectForm(), Ibm_db2Installer\submitConnectForm(), MysqlInstaller\submitConnectForm(), OracleInstaller\submitInstallUserBox(), DatabaseInstaller\submitInstallUserBox(), DatabaseInstaller\submitSettingsForm(), PostgresInstaller\submitSettingsForm(), MysqlInstaller\submitSettingsForm(), DatabaseInstaller\submitWebUserBox(), SpecialUploadStash\tryClearStashedUploads(), Preferences\tryUISubmit(), and MediaHandler\verifyUpload().

Status::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.

Return true if the replacement was done, false otherwise.

Returns:
bool

Definition at line 339 of file Status.php.

Status::setResult ( ok,
value = null 
)

Change operation result.

Parameters:
$okBoolean: whether the operation completed
$valueMixed

Definition at line 57 of file Status.php.

References $ok, and $value.

Status::warning ( message)

Add a new warning.

Parameters:
$messageString: message name

Definition at line 86 of file Status.php.

Referenced by Installer\subscribeToMediaWikiAnnounce().

Here is the caller graph for this function:


Member Data Documentation

Status::$cleanCallback = false

Definition at line 25 of file Status.php.

Status::$errors = array()

Definition at line 24 of file Status.php.

Referenced by getWikiTextArray().

Status::$failCount = 0

Definition at line 20 of file Status.php.

Status::$ok = true

Definition at line 16 of file Status.php.

Referenced by setResult().

Status::$success = array()

Array to indicate which items of the batch operations were successful.

Definition at line 22 of file Status.php.

Status::$successCount = 0

Counters for batch operations.

Definition at line 20 of file Status.php.

Status::$value

Definition at line 17 of file Status.php.

Referenced by FileRepoStatus\newGood(), newGood(), and setResult().


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