MediaWiki  REL1_20
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.
 getValue ()
 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.
 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)
 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 35 of file Status.php.


Member Function Documentation

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

Definition at line 148 of file Status.php.

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

Definition at line 156 of file Status.php.

References $params.

Referenced by getWikiTextForError().

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 122 of file Status.php.

References $params.

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 136 of file Status.php.

References $params.

Referenced by SwiftFileBackend\doCopyInternal(), SwiftFileBackend\doDeleteInternal(), SwiftFileBackend\doMoveInternal(), SwiftFileBackend\doStoreInternal(), SwiftFileBackend\doStreamFile(), and getWikiText().

Get the list of errors (but not warnings)

Returns:
Array

Definition at line 258 of file Status.php.

References getStatusArray().

Referenced by CliInstaller\showStatusMessage().

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 299 of file Status.php.

References $result.

Backward compatibility function for WikiError -> Status migration.

Returns:
String

Definition at line 348 of file Status.php.

References getWikiText().

Status::getStatusArray ( type) [protected]

Returns a list of status messages of the given type.

Parameters:
$typeString
Returns:
Array

Definition at line 277 of file Status.php.

References $result.

Referenced by getErrorsArray(), and getWarningsArray().

Returns:
mixed

Definition at line 355 of file Status.php.

Get the list of warnings (but not errors)

Returns:
Array

Definition at line 267 of file Status.php.

References getStatusArray().

Referenced by CliInstaller\showStatusMessage().

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 175 of file Status.php.

References $s, fatal(), getWikiTextArray(), getWikiTextForError(), and wfMessage().

Referenced by getMessage().

Status::getWikiTextArray ( errors)

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

Parameters:
$errorsArray
Returns:
Array

Definition at line 233 of file Status.php.

References $errors.

Referenced by getWikiText().

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 213 of file Status.php.

References cleanParams(), and wfMessage().

Referenced by getWikiText().

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 315 of file Status.php.

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

Returns:
Boolean

Definition at line 90 of file Status.php.

Returns whether the operation completed.

Returns:
Boolean

Definition at line 99 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 243 of file Status.php.

Referenced by SwiftFileBackend\doPrepareInternal(), SwiftFileBackend\doPublishInternal(), SwiftFileBackend\doSecureInternal(), FileOpBatch\runBatchParallel(), and FileOpBatch\runBatchSeries().

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

Factory function for good results.

Parameters:
$valueMixed
Returns:
Status

Definition at line 67 of file Status.php.

References $result, and $value.

Referenced by ImportStreamSource\__construct(), PoolCounter_Stub\acquireForAnyone(), PoolCounter_Stub\acquireForMe(), FileOpBatch\attempt(), ImportReporter\close(), PostgresInstaller\commitChanges(), SwiftFileBackend\doCleanInternal(), SwiftFileBackend\doCopyInternal(), SwiftFileBackend\doCreateInternal(), SwiftFileBackend\doDeleteInternal(), SwiftFileBackend\doExecuteOpHandlesInternal(), NullFileJournal\doLogChangeBatch(), SwiftFileBackend\doMoveInternal(), RevDel_RevisionList\doPostCommitUpdates(), RevDel_List\doPostCommitUpdates(), RevDel_ArchiveList\doPostCommitUpdates(), RevDel_FileList\doPostCommitUpdates(), RevDel_RevisionList\doPreCommitUpdates(), RevDel_List\doPreCommitUpdates(), RevDel_ArchiveList\doPreCommitUpdates(), RevDel_FileList\doPreCommitUpdates(), SwiftFileBackend\doPrepareInternal(), SwiftFileBackend\doPublishInternal(), NullFileJournal\doPurgeOldLogs(), SwiftFileBackend\doSecureInternal(), SwiftFileBackend\doStoreInternal(), SwiftFileBackend\doStreamFile(), ZipDirectoryReader\execute(), UploadFromUrl\fetchFile(), UploadBase\fetchFile(), UserrightsPage\fetchUser(), PostgresInstaller\getPgConnection(), WebInstaller_ExistingWiki\importVariables(), FileJournal\logChangeBatch(), SpecialUnlockdb\onSubmit(), SpecialLockdb\onSubmit(), Ibm_db2Installer\openConnection(), MysqlInstaller\openConnection(), OracleInstaller\openConnection(), PostgresInstaller\openConnectionToAnyDB(), PostgresInstaller\openConnectionWithParams(), OracleInstaller\openSYSDBAConnection(), PoolCounter_Stub\release(), UserMailer\send(), UserMailer\sendWithPear(), WikiImporter\setTargetRootPage(), OracleInstaller\setupDatabase(), PostgresInstaller\setupDatabase(), PostgresInstaller\setupPLpgSQL(), PostgresInstaller\setupSchema(), OracleInstaller\setupUser(), MysqlInstaller\setupUser(), PostgresInstaller\setupUser(), RevDel_List\setVisibility(), SpecialUploadStash\showUploads(), PostgresInstaller\submitConnectForm(), OracleInstaller\submitConnectForm(), Ibm_db2Installer\submitConnectForm(), MysqlInstaller\submitConnectForm(), OracleInstaller\submitInstallUserBox(), PostgresInstaller\submitSettingsForm(), MysqlInstaller\submitSettingsForm(), SyncFileBackend\syncFileBatch(), 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 332 of file Status.php.

References $source.

Status::setResult ( ok,
value = null 
)

Change operation result.

Parameters:
$okBoolean: whether the operation completed
$valueMixed

Definition at line 79 of file Status.php.

References $ok, and $value.

Status::warning ( message)

Add a new warning.

Parameters:
$messageString: message name

Definition at line 108 of file Status.php.

References $params.


Member Data Documentation

Status::$cleanCallback = false

Definition at line 45 of file Status.php.

Status::$errors = array()

Definition at line 44 of file Status.php.

Referenced by getWikiTextArray().

Status::$failCount = 0

Definition at line 40 of file Status.php.

Status::$ok = true

Definition at line 36 of file Status.php.

Referenced by setResult().

Status::$success = array()

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

Definition at line 42 of file Status.php.

Status::$successCount = 0

Counters for batch operations.

Definition at line 40 of file Status.php.

Status::$value

Definition at line 37 of file Status.php.

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


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