Go to the documentation of this file.
30 'setContentValue' =>
'3',
35 $this->fail(
'Expected exception not thrown' );
36 }
catch ( RuntimeException $ex ) {
38 'Attempting to add element setValue=99, existing value is 1',
46 $this->fail(
'Expected exception not thrown' );
47 }
catch ( RuntimeException $ex ) {
49 'Attempting to set content element as setContentValue2 when setContentValue ' .
50 'is already set as the content element',
57 $this->assertSame(
'99', $arr[
'setValue'] );
62 $arr = [
'foo' => 1,
'bar' => 1 ];
68 $this->assertSame( [ 0,
'top',
'foo',
'bar',
'bottom' ], array_keys( $arr ) );
73 $this->assertSame( [
'sub' => [
'foo' => 1,
'bar' => 1 ] ], $arr );
77 $this->fail(
'Expected exception not thrown' );
78 }
catch ( RuntimeException $ex ) {
80 'Conflicting keys (foo) when attempting to merge element sub',
101 $this->fail(
'Expected exception not thrown' );
102 }
catch ( InvalidArgumentException $ex ) {
104 'Cannot add resource(stream) to ApiResult',
111 $this->fail(
'Expected exception not thrown' );
112 }
catch ( InvalidArgumentException $ex ) {
114 'Cannot add resource(stream) to ApiResult',
122 $this->fail(
'Expected exception not thrown' );
123 }
catch ( InvalidArgumentException $ex ) {
125 'Cannot add resource(stream) to ApiResult',
133 $this->fail(
'Expected exception not thrown' );
134 }
catch ( InvalidArgumentException $ex ) {
136 'Cannot add resource(stream) to ApiResult',
145 $this->fail(
'Expected exception not thrown' );
146 }
catch ( InvalidArgumentException $ex ) {
148 'Cannot add non-finite floats to ApiResult',
155 $this->fail(
'Expected exception not thrown' );
156 }
catch ( InvalidArgumentException $ex ) {
158 'Cannot add non-finite floats to ApiResult',
165 $this->fail(
'Expected exception not thrown' );
166 }
catch ( InvalidArgumentException $ex ) {
168 'Cannot add non-finite floats to ApiResult',
175 $this->fail(
'Expected exception not thrown' );
176 }
catch ( InvalidArgumentException $ex ) {
178 'Cannot add non-finite floats to ApiResult',
188 $this->fail(
'Expected exception not thrown' );
189 }
catch ( InvalidArgumentException $ex ) {
191 'Cannot add non-finite floats to ApiResult',
199 $result2->addValue(
null,
'foo',
'bar' );
215 'foo' =>
"foo\xef\xbf\xbdbar",
218 0 =>
"foo\xef\xbf\xbdbar",
240 $result->addValue(
null,
'setValue',
'1' );
242 $result->addValue(
null,
null,
'unnamed 1' );
243 $result->addValue(
null,
null,
'unnamed 2' );
245 $result->addValue(
null,
'deleteValue',
'2' );
246 $result->removeValue(
null,
'deleteValue' );
248 $result->addValue( [
'a',
'b' ],
'deleteValue',
'3' );
249 $result->removeValue( [
'a',
'b',
'deleteValue' ],
null,
'3' );
251 $result->addContentValue(
null,
'setContentValue',
'3' );
257 'a' => [
'b' => [] ],
258 'setContentValue' =>
'3',
262 $this->assertSame( 20,
$result->getSize() );
265 $result->addValue(
null,
'setValue',
'99' );
266 $this->fail(
'Expected exception not thrown' );
267 }
catch ( RuntimeException $ex ) {
269 'Attempting to add element setValue=99, existing value is 1',
276 $result->addContentValue(
null,
'setContentValue2',
'99' );
277 $this->fail(
'Expected exception not thrown' );
278 }
catch ( RuntimeException $ex ) {
280 'Attempting to set content element as setContentValue2 when setContentValue ' .
281 'is already set as the content element',
288 $this->assertSame(
'99',
$result->getResultData( [
'setValue' ] ) );
291 $this->assertSame(
'setContentValue2',
298 $this->assertSame( 0,
$result->getSize() );
300 $result->addValue(
null,
'foo', 1 );
301 $result->addValue(
null,
'bar', 1 );
304 $result->addValue(
null,
'bottom',
'2' );
308 array_keys(
$result->getResultData() ) );
311 $result->addValue(
null,
'foo', [
'bar' => 1 ] );
313 $result->addValue( [
'foo',
'bottom' ],
'x', 2 );
314 $this->assertSame( [
'top',
'bar',
'bottom' ],
315 array_keys(
$result->getResultData( [
'foo' ] ) ) );
318 $result->addValue(
null,
'sub', [
'foo' => 1 ] );
319 $result->addValue(
null,
'sub', [
'bar' => 1 ] );
321 'sub' => [
'foo' => 1,
'bar' => 1 ],
326 $result->addValue(
null,
'sub', [
'foo' => 2,
'baz' => 2 ] );
327 $this->fail(
'Expected exception not thrown' );
328 }
catch ( RuntimeException $ex ) {
330 'Conflicting keys (foo) when attempting to merge element sub',
342 $result->addValue(
null,
'obj', $obj );
344 'title' => (
string)
$title,
351 $result->addValue(
null,
'file', $fh );
352 $this->fail(
'Expected exception not thrown' );
353 }
catch ( InvalidArgumentException $ex ) {
355 'Cannot add resource(stream) to ApiResult',
361 $result->addValue(
null,
null, $fh );
362 $this->fail(
'Expected exception not thrown' );
363 }
catch ( InvalidArgumentException $ex ) {
365 'Cannot add resource(stream) to ApiResult',
372 $result->addValue(
null,
'sub', $obj );
373 $this->fail(
'Expected exception not thrown' );
374 }
catch ( InvalidArgumentException $ex ) {
376 'Cannot add resource(stream) to ApiResult',
383 $result->addValue(
null,
null, $obj );
384 $this->fail(
'Expected exception not thrown' );
385 }
catch ( InvalidArgumentException $ex ) {
387 'Cannot add resource(stream) to ApiResult',
395 $result->addValue(
null,
'inf', INF );
396 $this->fail(
'Expected exception not thrown' );
397 }
catch ( InvalidArgumentException $ex ) {
399 'Cannot add non-finite floats to ApiResult',
405 $result->addValue(
null,
null, INF );
406 $this->fail(
'Expected exception not thrown' );
407 }
catch ( InvalidArgumentException $ex ) {
409 'Cannot add non-finite floats to ApiResult',
415 $result->addValue(
null,
'nan', NAN );
416 $this->fail(
'Expected exception not thrown' );
417 }
catch ( InvalidArgumentException $ex ) {
419 'Cannot add non-finite floats to ApiResult',
425 $result->addValue(
null,
null, NAN );
426 $this->fail(
'Expected exception not thrown' );
427 }
catch ( InvalidArgumentException $ex ) {
429 'Cannot add non-finite floats to ApiResult',
439 $this->fail(
'Expected exception not thrown' );
440 }
catch ( InvalidArgumentException $ex ) {
442 'Cannot add non-finite floats to ApiResult',
449 $result->addParsedLimit(
'foo', 12 );
451 'limits' => [
'foo' => 12 ],
454 $result->addParsedLimit(
'foo', 13 );
456 'limits' => [
'foo' => 13 ],
459 $this->assertSame(
null,
$result->getResultData( [
'foo',
'bar',
'baz' ] ) );
460 $this->assertSame( 13,
$result->getResultData( [
'limits',
'foo' ] ) );
462 $result->getResultData( [
'limits',
'foo',
'bar' ] );
463 $this->fail(
'Expected exception not thrown' );
464 }
catch ( InvalidArgumentException $ex ) {
466 'Path limits.foo is not an array',
474 $obj = [
'attr' =>
'12345' ];
476 $this->assertTrue(
$result->addValue(
null,
'foo', $obj ) );
477 $this->assertSame( 15,
$result->getSize() );
481 $result->setErrorFormatter( $formatter );
482 $this->assertFalse(
$result->addValue(
null,
'foo',
'12345678901' ) );
484 $this->assertSame( 0,
$result->getSize() );
486 $this->assertTrue(
$result->addValue(
null,
'foo',
'1234567890' ) );
487 $this->assertFalse(
$result->addValue(
null,
'foo',
'1' ) );
488 $result->removeValue(
null,
'foo' );
489 $this->assertTrue(
$result->addValue(
null,
'foo',
'1' ) );
493 $obj->foobar =
'foobaz';
494 $this->assertTrue(
$result->addValue(
null,
'foo', $obj ) );
495 $this->assertSame( 2,
$result->getSize() );
499 $result2->addValue(
null,
'foo',
'bar' );
500 $result->addValue(
null,
'baz', $result2 );
510 $result->addValue(
null,
'foo',
"foo\x80bar" );
511 $result->addValue(
null,
'bar',
"a\xcc\x81" );
512 $result->addValue(
null,
'baz', 74 );
513 $result->addValue(
null,
null,
"foo\x80bar" );
514 $result->addValue(
null,
null,
"a\xcc\x81" );
516 'foo' =>
"foo\xef\xbf\xbdbar",
519 0 =>
"foo\xef\xbf\xbdbar",
528 $result->addValue( $arr,
'foo', $obj );
542 $arr = [
'foo' => [
'bar' => [] ] ];
544 $result->addValue(
null,
'foo', [
'bar' => [] ] );
571 $this->assertSame( $expect, $arr );
573 $result->addSubelementsList(
null,
'foo' );
574 $result->addSubelementsList(
null, [
'bar',
'baz' ] );
575 $result->removeSubelementsList(
null,
'baz' );
576 $result->addIndexedTagNameRecursive(
null,
'ritn' );
577 $result->addIndexedTagName(
null,
'itn' );
578 $result->addPreserveKeysList(
null,
'foo' );
579 $result->addPreserveKeysList(
null, [
'bar',
'baz' ] );
580 $result->removePreserveKeysList(
null,
'baz' );
581 $result->addArrayTypeRecursive(
null,
'default' );
582 $result->addArrayType(
null,
'array' );
583 $this->assertEquals( $expect,
$result->getResultData() );
585 $arr = [
'foo' => [
'bar' => [] ] ];
600 $this->assertSame( $expect, $arr );
609 'bar' => [
'_dummy' =>
'foobaz' ],
610 'bar2' => (
object)[
'_dummy' =>
'foobaz' ],
612 '_dummy' =>
'foobaz',
615 'bar' => [
'_dummy' =>
'foobaz' ],
616 'bar2' => (
object)[
'_dummy' =>
'foobaz' ],
618 '_dummy' =>
'foobaz',
624 '_dummy' =>
'foobaz',
625 '_dummy2' =>
'foobaz!',
627 $this->assertEquals( [
630 'bar2' => (
object)[],
635 'bar2' => (
object)[],
638 '_dummy2' =>
'foobaz!',
643 $this->assertEquals( [
645 'bar' => [
'_dummy' =>
'foobaz' ],
646 'bar2' => (
object)[
'_dummy' =>
'foobaz' ],
648 '_dummy' =>
'foobaz',
651 'bar' => [
'_dummy' =>
'foobaz' ],
652 'bar2' => (
object)[
'_dummy' =>
'foobaz' ],
654 '_dummy' =>
'foobaz',
656 '_dummy2' =>
'foobaz!',
657 ],
$data,
'ApiResult::stripMetadataNonRecursive ($data)' );
658 $this->assertEquals( [
663 '_dummy' =>
'foobaz',
664 ], $metadata,
'ApiResult::stripMetadataNonRecursive ($metadata)' );
668 $this->assertEquals( (
object)[
670 'bar' => [
'_dummy' =>
'foobaz' ],
671 'bar2' => (
object)[
'_dummy' =>
'foobaz' ],
673 '_dummy' =>
'foobaz',
676 'bar' => [
'_dummy' =>
'foobaz' ],
677 'bar2' => (
object)[
'_dummy' =>
'foobaz' ],
679 '_dummy' =>
'foobaz',
681 '_dummy2' =>
'foobaz!',
682 ],
$data,
'ApiResult::stripMetadataNonRecursive on object ($data)' );
683 $this->assertEquals( [
688 '_dummy' =>
'foobaz',
689 ], $metadata,
'ApiResult::stripMetadataNonRecursive on object ($metadata)' );
704 if ( $expect instanceof Exception ) {
707 $this->fail(
'Expected exception not thrown', $label );
708 }
catch ( Exception $ex ) {
709 $this->assertEquals( $ex, $expect, $label );
713 $this->assertEquals( $expect,
$output, $label );
718 $kvp =
function ( $keyKey, $key, $valKey,
$value ) {
728 'defaultArray' => [ 2 =>
'a', 0 =>
'b', 1 =>
'c' ],
729 'defaultAssoc' => [
'x' =>
'a', 1 =>
'b', 0 =>
'c' ],
730 'defaultAssoc2' => [ 2 =>
'a', 3 =>
'b', 0 =>
'c' ],
736 'BCkvp' => [
'x' =>
'a',
'y' =>
'b',
740 'kvpmerge' => [
'x' =>
'a',
'y' => [
'b' ],
'z' => [
'c' =>
'd' ],
744 'emptyDefault' => [
'_dummy' => 1 ],
751 'bar' => [
'_dummy' =>
'foobaz' ],
759 '_dummy' =>
'foobaz',
765 '_dummy' =>
'foobaz',
766 '_dummy2' =>
'foobaz!',
788 'BC: META_BC_SUBELEMENTS',
820 'foo' =>
'foo value',
821 'bar' =>
'bar value',
822 '_baz' =>
'baz value',
829 $kvp(
'key',
'foo',
'*',
'foo value' ),
830 $kvp(
'key',
'bar',
'*',
'bar value' ),
831 $kvp(
'key',
'_baz',
'*',
'baz value' ),
858 'BC: BCkvp exception',
863 new UnexpectedValueException(
864 'Type "BCkvp" used without setting ApiResult::META_KVP_KEY_NAME metadata item'
868 'BC: nobool, no*, nosub',
872 'content' =>
'content',
879 'foo' =>
'foo value',
880 'bar' =>
'bar value',
881 '_baz' =>
'baz value',
887 [
'BC' => [
'nobool',
'no*',
'nosub' ] ],
891 'content' =>
'content',
896 $kvp(
'key',
'foo',
'*',
'foo value' ),
897 $kvp(
'key',
'bar',
'*',
'bar value' ),
898 $kvp(
'key',
'_baz',
'*',
'baz value' ),
909 'Types: Normal transform',
920 'kvp' => [
'x' =>
'a',
'y' =>
'b',
924 'BCkvp' => [
'x' =>
'a',
'y' =>
'b',
943 'Types: AssocAsObject',
945 [
'Types' => [
'AssocAsObject' =>
true ] ],
948 'defaultAssoc' => (
object)[
'x' =>
'a',
951 'defaultAssoc2' => (
object)[ 2 =>
'a', 3 =>
'b',
958 'kvp' => (
object)[
'x' =>
'a',
'y' =>
'b',
962 'BCkvp' => (
object)[
'x' =>
'a',
'y' =>
'b',
966 'kvpmerge' => (
object)[
983 [
'Types' => [
'ArmorKVP' =>
'name' ] ],
993 $kvp(
'name',
'x',
'value',
'a' ),
994 $kvp(
'name',
'y',
'value',
'b' ),
999 $kvp(
'key',
'x',
'value',
'a' ),
1000 $kvp(
'key',
'y',
'value',
'b' ),
1005 $kvp(
'name',
'x',
'value',
'a' ),
1024 'Types: ArmorKVP + BC',
1026 [
'BC' => [],
'Types' => [
'ArmorKVP' =>
'name' ] ],
1036 $kvp(
'name',
'x',
'*',
'a' ),
1037 $kvp(
'name',
'y',
'*',
'b' ),
1042 $kvp(
'key',
'x',
'*',
'a' ),
1043 $kvp(
'key',
'y',
'*',
'b' ),
1048 $kvp(
'name',
'x',
'*',
'a' ),
1066 'Types: ArmorKVP + AssocAsObject',
1068 [
'Types' => [
'ArmorKVP' =>
'name',
'AssocAsObject' =>
true ] ],
1071 'defaultAssoc' => (
object)[
'x' =>
'a', 1 =>
'b',
1074 'defaultAssoc2' => (
object)[ 2 =>
'a', 3 =>
'b',
1082 (
object)$kvp(
'name',
'x',
'value',
'a' ),
1083 (
object)$kvp(
'name',
'y',
'value',
'b' ),
1088 (
object)$kvp(
'key',
'x',
'value',
'a' ),
1089 (
object)$kvp(
'key',
'y',
'value',
'b' ),
1094 (
object)$kvp(
'name',
'x',
'value',
'a' ),
1113 'Types: BCkvp exception',
1118 new UnexpectedValueException(
1119 'Type "BCkvp" used without setting ApiResult::META_KVP_KEY_NAME metadata item'
1124 'Strip: With ArmorKVP + AssocAsObject transforms',
1126 [
'Types' => [
'ArmorKVP' =>
'name',
'AssocAsObject' =>
true ],
'Strip' =>
'all' ],
1128 'defaultArray' => [
'b',
'c',
'a' ],
1129 'defaultAssoc' => (
object)[
'x' =>
'a', 1 =>
'b', 0 =>
'c' ],
1130 'defaultAssoc2' => (
object)[ 2 =>
'a', 3 =>
'b', 0 =>
'c' ],
1131 'array' => [
'a',
'c',
'b' ],
1132 'BCarray' => [
'a',
'c',
'b' ],
1133 'BCassoc' => (
object)[
'a',
'b',
'c' ],
1134 'assoc' => (
object)[ 2 =>
'a', 0 =>
'b', 1 =>
'c' ],
1136 (
object)[
'name' =>
'x',
'value' =>
'a' ],
1137 (
object)[
'name' =>
'y',
'value' =>
'b' ],
1138 (
object)[
'name' =>
'z',
'value' => [
'c' ] ],
1141 (
object)[
'key' =>
'x',
'value' =>
'a' ],
1142 (
object)[
'key' =>
'y',
'value' =>
'b' ],
1145 (
object)[
'name' =>
'x',
'value' =>
'a' ],
1146 (
object)[
'name' =>
'y',
'value' => [
'b' ] ],
1147 (
object)[
'name' =>
'z',
'c' =>
'd' ],
1149 'emptyDefault' => [],
1150 'emptyAssoc' => (
object)[],
1158 [
'Strip' =>
'all' ],
1165 '_dummy2' =>
'foobaz!',
1171 [
'Strip' =>
'base' ],
1174 'bar' => [
'_dummy' =>
'foobaz' ],
1182 '_dummy' =>
'foobaz',
1184 '_dummy2' =>
'foobaz!',
1190 [
'Strip' =>
'bc' ],
1200 '_dummy2' =>
'foobaz!',
1218 'Custom' => [ $this,
'customTransform' ],
1226 'baz' => [
'a',
'b' ],
1227 '_dummy2' =>
'_DUMMY2',
1228 '_dummy3' =>
'_DUMMY3',
1242 if ( isset( $metadata[
'_added'] ) ) {
1247 foreach (
$data as $k => $v ) {
1248 $data[$k] = strtoupper( $k );
1250 $data[
'baz'] = [
'_added' => 1,
'z' =>
'b',
'y' =>
'a' ];
1263 'sequential_numeric_keys' => [
'a',
'b',
'c' ],
1264 'non_sequential_numeric_keys' => [
'a',
'b', 4 =>
'c' ],
1269 'object_sequential_keys' => (
object)[
'a',
'b',
'c' ],
1270 '_type' =>
"should be overwritten in result",
1272 $this->assertSame( [
1277 'sequential_numeric_keys',
'non_sequential_numeric_keys',
1278 'string_keys',
'object_sequential_keys'
1285 'sequential_numeric_keys' => [
1293 'non_sequential_numeric_keys' => [
1312 'object_sequential_keys' => [
1328 $this->assertSame( [
1336 $this->assertSame(
'Ok', $arr[
'foo'] );
1340 $this->assertSame(
'Ok', $arr[
'foo'] );
1347 $this->fail(
'Expected exception not thrown' );
1348 }
catch ( UnexpectedValueException $ex ) {
1350 'ApiResultTestSerializableObject::serializeForApiResult() ' .
1351 'returned an object of class ApiResultTestStringifiableObject',
1353 'Expected exception'
1360 $this->fail(
'Expected exception not thrown' );
1361 }
catch ( UnexpectedValueException $ex ) {
1363 'ApiResultTestSerializableObject::serializeForApiResult() ' .
1364 'returned an invalid value: Cannot add non-finite floats to ApiResult',
1366 'Expected exception'
1377 $this->assertSame( [
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
testInstanceDataMethods()
ApiResult.
testAddMetadataToResultVars()
ApiResult.
customTransform(&$data, &$metadata)
Custom transformer for testTransformations.
const META_TYPE
Key for the 'type' metadata item.
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message. Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item. Return false to stop further processing of the tag $reader:XMLReader object $logInfo:Array of information 'ImportHandlePageXMLTag':When parsing a XML tag in a page. Return false to stop further processing of the tag $reader:XMLReader object & $pageInfo:Array of information 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. Return false to stop further processing of the tag $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. Return false to stop further processing of the tag $reader:XMLReader object 'ImportHandleUnknownUser':When a user doesn 't exist locally, this hook is called to give extensions an opportunity to auto-create it. If the auto-creation is successful, return false. $name:User name 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. Return false to stop further processing of the tag $reader:XMLReader object $revisionInfo:Array of information 'ImportLogInterwikiLink':Hook to change the interwiki link used in log entries and edit summaries for transwiki imports. & $fullInterwikiPrefix:Interwiki prefix, may contain colons. & $pageTitle:String that contains page title. 'ImportSources':Called when reading from the $wgImportSources configuration variable. Can be used to lazy-load the import sources list. & $importSources:The value of $wgImportSources. Modify as necessary. See the comment in DefaultSettings.php for the detail of how to structure this array. 'InfoAction':When building information to display on the action=info page. $context:IContextSource object & $pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect. & $title:Title object for the current page & $request:WebRequest & $ignoreRedirect:boolean to skip redirect check & $target:Title/string of redirect target & $article:Article object 'InternalParseBeforeLinks':during Parser 's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InternalParseBeforeSanitize':during Parser 's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings. Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not. Return true without providing an interwiki to continue interwiki search. $prefix:interwiki prefix we are looking for. & $iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InvalidateEmailComplete':Called after a user 's email has been invalidated successfully. $user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification. Callee may modify $url and $query, URL will be constructed as $url . $query & $url:URL to index.php & $query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) & $article:article(object) being checked 'IsTrustedProxy':Override the result of IP::isTrustedProxy() & $ip:IP being check & $result:Change this value to override the result of IP::isTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from & $allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of Sanitizer::validateEmail(), for instance to return false if the domain name doesn 't match your organization. $addr:The e-mail address entered by the user & $result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user & $result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we 're looking for a messages file for & $file:The messages file path, you can override this to change the location. 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces. Do not use this hook to add namespaces. Use CanonicalNamespaces for that. & $namespaces:Array of namespaces indexed by their numbers 'LanguageGetTranslatedLanguageNames':Provide translated language names. & $names:array of language code=> language name $code:language of the preferred translations 'LanguageLinks':Manipulate a page 's language links. This is called in various places to allow extensions to define the effective language links for a page. $title:The page 's Title. & $links:Array with elements of the form "language:title" in the order that they will be output. & $linkFlags:Associative array mapping prefixed links to arrays of flags. Currently unused, but planned to provide support for marking individual language links in the UI, e.g. for featured articles. 'LanguageSelector':Hook to change the language selector available on a page. $out:The output page. $cssClassName:CSS class name of the language selector. 'LinkBegin':DEPRECATED since 1.28! Use HtmlPageLinkRendererBegin instead. Used when generating internal and interwiki links in Linker::link(), before processing starts. Return false to skip default processing and return $ret. See documentation for Linker::link() for details on the expected meanings of parameters. $skin:the Skin object $target:the Title that the link is pointing to & $html:the contents that the< a > tag should have(raw HTML) $result
const META_BC_SUBELEMENTS
Key for the 'BC subelements' metadata item.
static setArrayTypeRecursive(array &$arr, $type, $kvpKeyName=null)
Set the array data type recursively.
const META_PRESERVE_KEYS
Key for the 'preserve keys' metadata item.
testObjectSerialization()
static setValue(array &$arr, $name, $value, $flags=0)
Add an output value to the array by name.
const NO_SIZE_CHECK
For addValue() and similar functions, do not check size while adding a value Don't use this unless yo...
const META_KVP_KEY_NAME
Key for the metadata item whose value specifies the name used for the kvp key in the alternative outp...
const NO_VALIDATE
For addValue(), setValue() and similar functions, do not validate data.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
static setContentValue(array &$arr, $name, $value, $flags=0)
Add an output value to the array by name and mark as META_CONTENT.
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)
static setArrayType(array &$arr, $type, $kvpKeyName=null)
Set the array data type.
namespace and then decline to actually register it file or subcat img or subcat $title
const META_INDEXED_TAG_NAME
Key for the 'indexed tag name' metadata item.
static addMetadataToResultVars( $vars, $forceHash=true)
Add the correct metadata to an array of vars we want to export through the API.
This class represents the result of the API operations.
if(is_array( $mode)) switch( $mode) $input
const META_SUBELEMENTS
Key for the 'subelements' metadata item.
static unsetValue(array &$arr, $name)
Remove an output value to the array by name.
const META_BC_BOOLS
Key for the 'BC bools' metadata item.
static stripMetadataNonRecursive( $data, &$metadata=null)
Remove metadata keys from a data array or object, non-recursive.
testUtilityFunctions()
ApiResult.
static unsetPreserveKeysList(array &$arr, $names)
Don't preserve specified keys.
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
testTransformations( $label, $input, $transforms, $expect)
ApiResult provideTransformations.
static setPreserveKeysList(array &$arr, $names)
Preserve specified keys.
const ADD_ON_TOP
For addValue(), setValue() and similar functions, if the value does not exist, add it as the first el...
static unsetSubelementsList(array &$arr, $names)
Causes the elements with the specified names to be output as attributes (when possible) rather than a...
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
const OVERRIDE
Override existing value in addValue(), setValue(), and similar functions.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
const META_KVP_MERGE
Key for the metadata item that indicates that the KVP key should be added into an assoc value,...
static factory( $code)
Get a cached or new language object for a given language code.
testStaticDataMethods()
ApiResult.
globals will be eliminated from MediaWiki replaced by an application object which would be passed to constructors Whether that would be an convenient solution remains to be but certainly PHP makes such object oriented programming models easier than they were in previous versions For the time being MediaWiki programmers will have to work in an environment with some global context At the time of globals were initialised on startup by MediaWiki of these were configuration which are documented in DefaultSettings php There is no comprehensive documentation for the remaining however some of the most important ones are listed below They are typically initialised either in index php or in Setup php $wgTitle Title object created from the request URL $wgOut OutputPage object for HTTP response $wgUser User object for the user associated with the current request $wgLang Language object selected by user preferences $wgContLang Language object associated with the wiki being viewed $wgParser Parser object Parser extensions register their hooks here $wgRequest WebRequest object
static setIndexedTagNameRecursive(array &$arr, $tag)
Set indexed tag name on $arr and all subarrays.
static stripMetadata( $data)
Recursively remove metadata keys from a data array or object.
const META_CONTENT
Key for the 'content' metadata item.
static setSubelementsList(array &$arr, $names)
Causes the elements with the specified names to be output as subelements rather than attributes.