55 public static function wrap( $sv ) {
56 if ( $sv instanceof
static ) {
60 $result =
new static();
61 $result->ok =& $sv->ok;
62 $result->errors =& $sv->errors;
63 $result->value =& $sv->value;
64 $result->successCount =& $sv->successCount;
65 $result->failCount =& $sv->failCount;
66 $result->success =& $sv->success;
79 if ( $name ===
'ok' ) {
82 if ( $name ===
'errors' ) {
86 throw new RuntimeException(
"Cannot get '$name' property." );
98 if ( $name ===
'ok' ) {
104 throw new RuntimeException(
"Cannot set '$name' property." );
120 list( $errorsOnlyStatus, $warningsOnlyStatus ) = parent::splitByErrorType();
121 $errorsOnlyStatus->cleanCallback =
122 $warningsOnlyStatus->cleanCallback = $this->cleanCallback;
141 if ( !$this->cleanCallback ) {
145 foreach (
$params as $i => $param ) {
157 if (
$lang ===
null ) {
158 return RequestContext::getMain()->getLanguage();
163 return Language::factory(
$lang );
179 if ( count( $rawErrors ) === 0 ) {
180 if ( $this->
isOK() ) {
181 $this->fatal(
'internalerror_info',
182 __METHOD__ .
" called for a good result, this is incorrect\n" );
184 $this->fatal(
'internalerror_info',
185 __METHOD__ .
": Invalid result object: no error text but not OK\n" );
189 if ( count( $rawErrors ) === 1 ) {
191 if ( $shortContext ) {
193 }
elseif ( $longContext ) {
198 foreach (
$errors as &$error ) {
199 $error = $error->plain();
201 $s =
'* ' . implode(
"\n* ",
$errors ) .
"\n";
202 if ( $longContext ) {
204 }
elseif ( $shortContext ) {
231 public function getMessage( $shortContext =
false, $longContext =
false,
$lang =
null ) {
235 if ( count( $rawErrors ) === 0 ) {
236 if ( $this->
isOK() ) {
237 $this->fatal(
'internalerror_info',
238 __METHOD__ .
" called for a good result, this is incorrect\n" );
240 $this->fatal(
'internalerror_info',
241 __METHOD__ .
": Invalid result object: no error text but not OK\n" );
245 if ( count( $rawErrors ) === 1 ) {
247 if ( $shortContext ) {
249 }
elseif ( $longContext ) {
251 $wrapper->params(
$s )->parse();
256 $msgCount = count( $msgs );
259 $s->params( $msgs )->parse();
261 if ( $longContext ) {
263 }
elseif ( $shortContext ) {
285 if (
isset( $error[
'message'] ) && $error[
'message'] instanceof
Message ) {
286 $msg = $error[
'message'];
298 throw new UnexpectedValueException(
'Got ' .
get_class( $error ) .
' for key.' );
313 public function getHTML( $shortContext =
false, $longContext =
false,
$lang =
null ) {
316 $out = MessageCache::singleton()->parse( $text,
null,
true,
true,
$lang );
318 ?
$out->getText( [
'enableSectionEditLinks' =>
false ] )
368 foreach ( $this->
getErrors() as $error ) {
369 if (
$type ===
false || $error[
'type'] ===
$type ) {
372 [ $error[
'message']->getKey() ],
373 $error[
'message']->getParams()
375 }
elseif ( $error[
'params'] ) {
376 $result[] =
array_merge( [ $error[
'message'] ], $error[
'params'] );
378 $result[] = [ $error[
'message'] ];
400 $this->cleanCallback =
false;
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
Internationalisation code.
The Message class provides methods which fulfil two basic services:
Variant of the Message class.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
getErrors()
Get the list of errors.
setOK( $ok)
Change operation status.
isOK()
Returns whether the operation completed.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
static wrap( $sv)
Succinct helper method to wrap a StatusValue.
getWikiText( $shortContext=false, $longContext=false, $lang=null)
Get the error list as a wikitext formatted list.
splitByErrorType()
Splits this Status object into two new Status objects, one which contains only the error messages,...
getErrorsArray()
Get the list of errors (but not warnings)
getErrorMessage( $error, $lang=null)
Return the message for a single error.
callable false $cleanCallback
__sleep()
Don't save the callback when serializing, because Closures can't be serialized and we're going to cle...
cleanParams(array $params)
__set( $name, $value)
Change operation result Backwards compatibility logic.
getErrorMessageArray( $errors, $lang=null)
Return an array with a Message object for each error.
getWarningsArray()
Get the list of warnings (but not errors)
getStatusValue()
Returns the wrapped StatusValue object.
languageFromParam( $lang)
getStatusArray( $type=false)
Returns a list of status messages of the given type (or all if false)
getHTML( $shortContext=false, $longContext=false, $lang=null)
Get the error message as HTML.
__wakeup()
Sanitize the callback parameter on wakeup, to avoid arbitrary execution.
__get( $name)
Backwards compatibility logic.
getMessage( $shortContext=false, $longContext=false, $lang=null)
Get a bullet list of the errors as a Message object.
Stub object for the user language.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
namespace being checked & $result
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<div ...>$1</div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
returning false will NOT prevent logging $e
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
if(!isset( $args[0])) $lang