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.
 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::cleanParams ( params  )  [protected]

Definition at line 87 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.

References ok().

Referenced by getWikiText().

Status::getErrorsArray (  ) 

Definition at line 174 of file Status.php.

References $error, and $result.

Status::getItemXML ( item  )  [protected]

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

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

Status::getXML (  ) 

Get the error list as XML.

Definition at line 113 of file Status.php.

References $error, and getItemXML().

Status::hasMessage ( msg  ) 

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

Definition at line 186 of file Status.php.

References $error, and $msg.

Status::isGood (  ) 

Definition at line 47 of file Status.php.

References ok().

Status::isOK (  ) 

Definition at line 51 of file Status.php.

References ok().

Status::merge ( other,
overwriteValue = false 
)

Merge another status object into this one.

Definition at line 164 of file Status.php.

References ok().

static Status::newFatal ( message  )  [static]

Factory function for fatal errors.

Reimplemented in FileRepoStatus.

Definition at line 28 of file Status.php.

References $result.

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

Definition at line 36 of file Status.php.

References $result, and $value.

Referenced by Article::doEdit().

Status::setResult ( ok,
value = null 
)

Definition at line 42 of file Status.php.

References $ok, $value, and ok().

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 Sep 5 02:08:48 2009 for MediaWiki by  doxygen 1.5.9