Status Class Reference

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

Inherited by FileRepoStatus.

List of all members.

Public Member Functions

 setResult ($ok, $value=null)
 isGood ()
 isOK ()
 warning ($message)
 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.
 __wakeup ()
 Sanitize the callback parameter on wakeup, to avoid arbitrary execution.
 getXML ()
 Get the error list as XML.
 getWikiText ($shortContext=false, $longContext=false)
 Get the error list as a wikitext formatted list.
 merge ($other, $overwriteValue=false)
 Merge another status object into this one.
 getErrorsArray ()
 hasMessage ($msg)
 Returns true if the specified message is present as a warning or error.

Static Public Member Functions

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

Public Attributes

 $ok = true
 $value
 $successCount = 0
 Counters for batch operations.
 $failCount = 0
 $errors = array()
 $cleanCallback = false

Protected Member Functions

 cleanParams ($params)
 getItemXML ($item)


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

Status::__wakeup (  ) 

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

Definition at line 90 of file Status.php.

Status::cleanParams ( params  )  [protected]

Definition at line 94 of file Status.php.

References $i.

Referenced by getItemXML(), and getWikiText().

Status::error ( message  ) 

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

Definition at line 67 of file Status.php.

Status::fatal ( message  ) 

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

Definition at line 78 of file Status.php.

Referenced by getWikiText().

Status::getErrorsArray (  ) 

Definition at line 181 of file Status.php.

References $result.

Status::getItemXML ( item  )  [protected]

Definition at line 105 of file Status.php.

References cleanParams(), Xml::element(), and wfMsgReal().

Referenced by getXML().

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

Get the error list as a wikitext formatted list.

Parameters:
string $shortContext A short enclosing context message name, to be used when there is a single error
string $longContext A long enclosing context message name, for a list

Definition at line 135 of file Status.php.

References $s, cleanParams(), fatal(), wfMsgNoTrans(), and wfMsgReal().

Status::getXML (  ) 

Get the error list as XML.

Definition at line 120 of file Status.php.

References getItemXML().

Status::hasMessage ( msg  ) 

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

Definition at line 196 of file Status.php.

References $msg.

Status::isGood (  ) 

Definition at line 47 of file Status.php.

Status::isOK (  ) 

Definition at line 51 of file Status.php.

Status::merge ( other,
overwriteValue = false 
)

Merge another status object into this one.

Definition at line 171 of file Status.php.

static Status::newFatal ( message  )  [static]

Factory function for fatal errors.

Reimplemented in FileRepoStatus.

Definition at line 28 of file Status.php.

References $result.

Referenced by HttpRequest::__construct(), and UploadFromUrl::fetchFile().

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

Status::setResult ( ok,
value = null 
)

Definition at line 42 of file Status.php.

References $ok, and $value.

Status::warning ( message  ) 

Definition at line 55 of file Status.php.


Member Data Documentation

Status::$cleanCallback = false

Definition at line 23 of file Status.php.

Status::$errors = array()

Definition at line 22 of file Status.php.

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::$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 newGood(), FileRepoStatus::newGood(), and setResult().


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

Generated on Sat Apr 30 22:57:50 2011 for MediaWiki by  doxygen 1.5.9