MediaWiki
REL1_19
|
Generic operation result class Has warning/error list, boolean status and arbitrary value. More...
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. |
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.
Status::__wakeup | ( | ) |
Sanitize the callback parameter on wakeup, to avoid arbitrary execution.
Definition at line 126 of file Status.php.
Status::cleanParams | ( | $ | params | ) | [protected] |
$params | array |
Definition at line 134 of file Status.php.
Referenced by getItemXML(), and getWikiTextForError().
Status::error | ( | $ | message | ) |
Add an error, do not set fatal flag This can be used for non-fatal errors.
$message | String: 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.
$message | String: message name |
Definition at line 114 of file Status.php.
Referenced by getWikiText().
Get the list of errors (but not warnings)
Definition at line 265 of file Status.php.
References getStatusArray().
Referenced by CliInstaller\showStatusMessage(), and WebInstaller\showStatusMessage().
Status::getErrorsByType | ( | $ | type | ) |
Returns a list of status messages of the given type, with message and params left untouched, like a sane version of getStatusArray.
$type | String |
Definition at line 306 of file Status.php.
References $result.
Status::getItemXML | ( | $ | item | ) | [protected] |
$item |
Definition at line 149 of file Status.php.
References cleanParams(), Xml\element(), and wfMsg().
Referenced by getXML().
Backward compatibility function for WikiError -> Status migration.
Definition at line 355 of file Status.php.
References getWikiText().
Status::getStatusArray | ( | $ | type | ) | [protected] |
Returns a list of status messages of the given type.
$type | String |
Definition at line 284 of file Status.php.
References $result.
Referenced by getErrorsArray(), and getWarningsArray().
Get the list of warnings (but not errors)
Definition at line 274 of file Status.php.
References getStatusArray().
Referenced by CliInstaller\showStatusMessage(), and WebInstaller\showStatusMessage().
Status::getWikiText | ( | $ | shortContext = false , |
$ | longContext = false |
||
) |
Get the error list as a wikitext formatted list.
$shortContext | String: a short enclosing context message name, to be used when there is a single error |
$longContext | String: a long enclosing context message name, for a list |
Definition at line 182 of file Status.php.
References fatal(), getWikiTextArray(), getWikiTextForError(), and wfMsgNoTrans().
Referenced by getMessage().
Status::getWikiTextArray | ( | $ | errors | ) |
Return an array with the wikitext for each item in the array.
$errors | Array |
Definition at line 240 of file Status.php.
References $errors.
Referenced by getWikiText().
Status::getWikiTextForError | ( | $ | error | ) | [protected] |
Return the wiki text for a single error.
$error | Mixed 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. |
Definition at line 220 of file Status.php.
References cleanParams(), and wfMsgNoTrans().
Referenced by getWikiText().
Status::getXML | ( | ) |
Get the error list as XML.
Definition at line 165 of file Status.php.
References getItemXML().
Status::hasMessage | ( | $ | msg | ) |
Returns true if the specified message is present as a warning or error.
$msg | String: message name |
Definition at line 322 of file Status.php.
Status::isGood | ( | ) |
Returns whether the operation completed and didn't have any error or warnings.
Definition at line 68 of file Status.php.
Status::isOK | ( | ) |
Status::merge | ( | $ | other, |
$ | overwriteValue = false |
||
) |
Merge another status object into this one.
$other | Status Other Status object |
$overwriteValue | Boolean: whether to override the "value" member |
Definition at line 250 of file Status.php.
Referenced by ScopedLock\factory().
static Status::newFatal | ( | $ | message | ) | [static] |
Factory function for fatal errors.
$message | String: 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().
static Status::newGood | ( | $ | value = null | ) | [static] |
Factory function for good results.
$value | Mixed |
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.
Definition at line 339 of file Status.php.
Status::setResult | ( | $ | ok, |
$ | value = null |
||
) |
Change operation result.
$ok | Boolean: whether the operation completed |
$value | Mixed |
Definition at line 57 of file Status.php.
Status::warning | ( | $ | message | ) |
Add a new warning.
$message | String: message name |
Definition at line 86 of file Status.php.
Referenced by Installer\subscribeToMediaWikiAnnounce().
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().