15 'wgAllowUserJs' =>
false,
16 'wgDefaultLanguageVariant' =>
false,
17 'wgMetaNamespace' =>
'Project',
27 $titlechars = Title::legalChars();
29 foreach ( range( 1, 255 )
as $num ) {
31 if ( strpos(
"#[]{}<>|", $chr ) !==
false || preg_match(
"/[\\x00-\\x1f\\x7f]/", $chr ) ) {
33 (
bool)preg_match(
"/[$titlechars]/", $chr ),
34 "chr($num) = $chr is not a valid titlechar"
38 (
bool)preg_match(
"/[$titlechars]/", $chr ),
39 "chr($num) = $chr is a valid titlechar"
56 [
'Talk:Foo:Sandbox' ],
57 [
'File:Example.svg' ],
58 [
'File_talk:Example.svg' ],
59 [
'Foo/.../Sandbox' ],
64 [
'Category:' . str_repeat(
'x', 248 ) ],
65 [ str_repeat(
'x', 252 ) ],
67 [
'localtestiw: #anchor' ],
69 [
'localtestiw:foo' ],
70 [
'localtestiw: foo # anchor' ],
71 [
'localtestiw: Talk: Sandbox # anchor' ],
73 [
'remotetestiw: Talk: # anchor' ],
74 [
'remotetestiw: #bar' ],
75 [
'remotetestiw: Talk:' ],
76 [
'remotetestiw: Talk: Foo' ],
77 [
'localtestiw:remotetestiw:' ],
78 [
'localtestiw:remotetestiw:foo' ]
84 [
'',
'title-invalid-empty' ],
85 [
':',
'title-invalid-empty' ],
86 [
'__ __',
'title-invalid-empty' ],
87 [
' __ ',
'title-invalid-empty' ],
89 [
'A [ B',
'title-invalid-characters' ],
90 [
'A ] B',
'title-invalid-characters' ],
91 [
'A { B',
'title-invalid-characters' ],
92 [
'A } B',
'title-invalid-characters' ],
93 [
'A < B',
'title-invalid-characters' ],
94 [
'A > B',
'title-invalid-characters' ],
95 [
'A | B',
'title-invalid-characters' ],
96 [
"A \t B",
'title-invalid-characters' ],
97 [
"A \n B",
'title-invalid-characters' ],
99 [
'A%20B',
'title-invalid-characters' ],
100 [
'A%23B',
'title-invalid-characters' ],
101 [
'A%2523B',
'title-invalid-characters' ],
109 [
'Talk:File:Example.svg',
'title-invalid-talk-namespace' ],
111 [
'.',
'title-invalid-relative' ],
112 [
'..',
'title-invalid-relative' ],
113 [
'./Sandbox',
'title-invalid-relative' ],
114 [
'../Sandbox',
'title-invalid-relative' ],
115 [
'Foo/./Sandbox',
'title-invalid-relative' ],
116 [
'Foo/../Sandbox',
'title-invalid-relative' ],
117 [
'Sandbox/.',
'title-invalid-relative' ],
118 [
'Sandbox/..',
'title-invalid-relative' ],
120 [
'A ~~~ Name',
'title-invalid-magic-tilde' ],
121 [
'A ~~~~ Signature',
'title-invalid-magic-tilde' ],
122 [
'A ~~~~~ Timestamp',
'title-invalid-magic-tilde' ],
124 [ str_repeat(
'x', 256 ),
'title-invalid-too-long' ],
126 [
'Talk:',
'title-invalid-empty' ],
127 [
'Talk:#',
'title-invalid-empty' ],
128 [
'Category: ',
'title-invalid-empty' ],
129 [
'Category: #bar',
'title-invalid-empty' ],
131 [
'localtestiw: Talk: # anchor',
'title-invalid-empty' ],
132 [
'localtestiw: Talk:',
'title-invalid-empty' ]
138 'wgLocalInterwikis' => [
'localtestiw' ],
140 'InterwikiLoadPrefix' => [
141 function ( $prefix, &
$data ) {
142 if ( $prefix ===
'localtestiw' ) {
143 $data = [
'iw_url' =>
'localtestiw' ];
144 } elseif ( $prefix ===
'remotetestiw' ) {
145 $data = [
'iw_url' =>
'remotetestiw' ];
155 Language::factory(
'en' ),
169 $this->assertInstanceOf( Title::class, Title::newFromText( $text ),
"Valid: $text" );
181 Title::newFromTextThrow( $text );
182 $this->assertTrue(
false,
"Invalid: $text" );
184 $this->assertEquals( $expectedErrorMessage, $ex->
getErrorMessage(),
"Invalid: $text" );
191 ' %!"$&\'()*,\\-.\\/0-9:;=?@A-Z\\\\^_`a-z~\\x80-\\xFF+',
192 ' %!"$&\'()*,\\-./0-9:;=?@A-Z\\\\\\^_`a-z~+\\u0080-\\uFFFF',
196 'QWERTYf-\\x7F+\\u0080-\\uFFFF',
199 'QWERTY\\x66-\\xFD+',
200 'QWERTYf-\\x7F+\\u0080-\\uFFFF',
208 'QWERTYf-\\x7F+\\u0080-\\uFFFF',
211 'QWERTY\\x66-\\x80+\\x23',
212 'QWERTYf-\\x7F+#\\u0080-\\uFFFF',
215 'QWERTY\\x66-\\x80+\\xD3',
216 'QWERTYf-\\x7F+\\u0080-\\uFFFF',
220 '\\\\\\u0080-\\uFFFF',
224 '\\-\\u0080-\\uFFFF',
228 'QWERTY\\-\\u0080-\\uFFFF',
236 'A-\\x7F\\u0080-\\uFFFF',
239 '\\x66-\\x77QWERTY\\x88-\\x91FXZ',
240 'f-wQWERTYFXZ\\u0080-\\uFFFF',
243 '\\x66-\\x99QWERTY\\xAA-\\xEEFXZ',
244 'f-\\x7FQWERTYFXZ\\u0080-\\uFFFF',
254 $this->assertEquals( $unicodeClass, Title::convertByteClassToUnicodeClass( $byteClass ) );
262 $title = Title::newFromText( $text );
263 $fixed =
$title->fixSpecialName();
264 $stuff = explode(
'/', $fixed->getDBkey(), 2 );
265 if ( count( $stuff ) == 2 ) {
273 "T33100 regression check: Title->fixSpecialName() should preserve parameter"
279 [
'Special:Version',
null ],
280 [
'Special:Version/',
'' ],
281 [
'Special:Version/param',
'param' ],
297 $nt = Title::newFromText( $target );
298 $errors =
$title->isValidMoveOperation( $nt,
false );
299 if ( $expected ===
true ) {
300 $this->assertTrue( $errors );
303 foreach ( (
array)$expected
as $error ) {
304 $this->assertContains( $error, $errors );
312 [
'Some page',
'',
'badtitletext' ],
313 [
'Test',
'Test',
'selfmove' ],
314 [
'Special:FooBar',
'Test',
'immobile-source-namespace' ],
315 [
'Test',
'Special:FooBar',
'immobile-target-namespace' ],
316 [
'MediaWiki:Common.js',
'Help:Some wikitext page',
'bad-target-model' ],
317 [
'Page',
'File:Test.jpg',
'nonfile-cannot-move-to-file' ],
318 [
'File:Test.jpg',
'Page',
'imagenocrossnamespace' ],
338 if ( is_string( $whitelistRegexp ) ) {
339 $whitelistRegexp = [ $whitelistRegexp ];
344 'wgGroupPermissions' => [
'*' => [
'read' =>
false ] ],
345 'wgWhitelistRead' => [
'some random non sense title' ],
346 'wgWhitelistReadRegexp' => $whitelistRegexp,
356 if ( is_bool( $expected ) ) {
357 # Forge the assertion message depending on the assertion expectation
358 $allowableness = $expected
359 ?
" should be allowed"
360 :
" should NOT be allowed";
364 "User action '$action' on [[$source]] $allowableness."
368 foreach ( (
array)$expected
as $error ) {
369 $this->assertContains( $error, $errors );
383 [
'/.*/',
'Main_Page',
'read', $ALLOWED ],
384 [
'/.*/',
'Main_Page',
'edit', $DISALLOWED ],
387 [
'/^Main_Page$/',
'Main_Page',
'read', $DISALLOWED ],
389 [
'/^Main/',
'Main_Page',
'read', $ALLOWED ],
390 [
'/^Main.*/',
'Main_Page',
'read', $ALLOWED ],
392 [
'/Mic\sCheck/',
'Mic Check',
'read', $ALLOWED ],
395 [
'/Unicode Test . Yes/',
'Unicode Test Ñ Yes',
'read', $DISALLOWED ],
397 [
'/Unicode Test . Yes/u',
'Unicode Test Ñ Yes',
'read', $ALLOWED ],
399 [
'/MiC ChEcK/',
'mic check',
'read', $DISALLOWED ],
400 [
'/MiC ChEcK/i',
'mic check',
'read', $ALLOWED ],
403 [
"@^UsEr.*@i",
'User is banned',
'read', $ALLOWED ],
404 [
"@^UsEr.*@i",
'User:John Doe',
'read', $ALLOWED ],
407 [
'/^Special:NewPages$/',
'Special:NewPages',
'read', $ALLOWED ],
408 [
null,
'Special:Newpages',
'read', $DISALLOWED ],
415 foreach ( $errors
as $error ) {
427 $lang, $variant, $msg =
''
431 'wgDefaultLanguageVariant' => $variant,
432 'wgAllowUserJs' =>
true,
437 $title = Title::newFromText( $titleText );
438 $this->assertInstanceOf( Title::class,
$title,
439 "Test must be passed a valid title text, you gave '$titleText'"
441 $this->assertEquals( $expected,
442 $title->getPageViewLanguage()->getCode(),
451 # - content language (expected in most cases)
452 # - wgLang (on some specific pages)
453 # - wgDefaultLanguageVariant
456 [
'fr',
'Help:I_need_somebody',
'fr',
'fr',
false ],
457 [
'es',
'Help:I_need_somebody',
'es',
'zh-tw',
false ],
458 [
'zh',
'Help:I_need_somebody',
'zh',
'zh-tw',
false ],
460 [
'es',
'Help:I_need_somebody',
'es',
'zh-tw',
'zh-cn' ],
461 [
'es',
'MediaWiki:About',
'es',
'zh-tw',
'zh-cn' ],
462 [
'es',
'MediaWiki:About/',
'es',
'zh-tw',
'zh-cn' ],
463 [
'de',
'MediaWiki:About/de',
'es',
'zh-tw',
'zh-cn' ],
464 [
'en',
'MediaWiki:Common.js',
'es',
'zh-tw',
'zh-cn' ],
465 [
'en',
'MediaWiki:Common.css',
'es',
'zh-tw',
'zh-cn' ],
466 [
'en',
'User:JohnDoe/Common.js',
'es',
'zh-tw',
'zh-cn' ],
467 [
'en',
'User:JohnDoe/Monobook.css',
'es',
'zh-tw',
'zh-cn' ],
469 [
'zh-cn',
'Help:I_need_somebody',
'zh',
'zh-tw',
'zh-cn' ],
470 [
'zh',
'MediaWiki:About',
'zh',
'zh-tw',
'zh-cn' ],
471 [
'zh',
'MediaWiki:About/',
'zh',
'zh-tw',
'zh-cn' ],
472 [
'de',
'MediaWiki:About/de',
'zh',
'zh-tw',
'zh-cn' ],
473 [
'zh-cn',
'MediaWiki:About/zh-cn',
'zh',
'zh-tw',
'zh-cn' ],
474 [
'zh-tw',
'MediaWiki:About/zh-tw',
'zh',
'zh-tw',
'zh-cn' ],
475 [
'en',
'MediaWiki:Common.js',
'zh',
'zh-tw',
'zh-cn' ],
476 [
'en',
'MediaWiki:Common.css',
'zh',
'zh-tw',
'zh-cn' ],
477 [
'en',
'User:JohnDoe/Common.js',
'zh',
'zh-tw',
'zh-cn' ],
478 [
'en',
'User:JohnDoe/Monobook.css',
'zh',
'zh-tw',
'zh-cn' ],
480 [
'zh-tw',
'Special:NewPages',
'es',
'zh-tw',
'zh-cn' ],
481 [
'zh-tw',
'Special:NewPages',
'zh',
'zh-tw',
'zh-cn' ],
492 $this->assertEquals( $expected,
500 # Title, expected base, optional message
501 [
'User:John_Doe/subOne/subTwo',
'John Doe/subOne' ],
502 [
'User:Foo/Bar/Baz',
'Foo/Bar' ],
512 $this->assertEquals( $expected,
520 # Title, expected base, optional message
521 [
'User:John_Doe/subOne/subTwo',
'John Doe' ],
522 [
'User:Foo/Bar/Baz',
'Foo' ],
533 $this->assertEquals( $expected,
541 # Title, expected base, optional message
542 [
'User:John_Doe/subOne/subTwo',
'subTwo' ],
543 [
'User:John_Doe/subOne',
'subOne' ],
562 $dbkey = str_replace(
' ',
'_',
$value->getText() );
563 $this->assertEquals( $dbkey,
$title->getDBkey() );
564 $this->assertEquals(
$value->getNamespace(),
$title->getNamespace() );
565 $this->assertEquals(
$value->getFragment(),
$title->getFragment() );
575 $dbkey = str_replace(
' ',
'_',
$value->getText() );
576 $this->assertEquals( $dbkey,
$title->getDBkey() );
577 $this->assertEquals(
$value->getNamespace(),
$title->getNamespace() );
578 $this->assertEquals(
$value->getFragment(),
$title->getFragment() );
585 $title = Title::newFromText( __METHOD__ );
586 $this->assertSame(
$title, Title::newFromLinkTarget(
$title ) );
589 $clone = Title::newFromLinkTarget(
$title, Title::NEW_CLONE );
590 $this->assertNotSame(
$title, $clone );
591 $this->assertTrue( $clone->equals(
$title ) );
598 [
'User:Hansi_Maier' ],
607 $title = Title::newFromText( $text );
610 $dbkey = str_replace(
' ',
'_',
$value->getText() );
611 $this->assertEquals(
$title->getDBkey(), $dbkey );
612 $this->assertEquals(
$title->getNamespace(),
$value->getNamespace() );
613 $this->assertEquals(
$title->getFragment(),
$value->getFragment() );
619 [
'Foo#bar',
'bar' ],
620 [
'Foo#bär',
'bär' ],
623 [
'Foo#bar_bar',
'bar bar' ],
624 [
'Foo#bar bar',
'bar bar' ],
625 [
'Foo#bar bar',
'bar bar' ],
629 [
'Foo#_bar_bar_',
' bar bar' ],
630 [
'Foo# bar bar ',
' bar bar' ],
642 $title = Title::newFromText( $full );
643 $this->assertEquals( $fragment,
$title->getFragment() );
653 $title = Title::newFromText( $page );
654 $this->assertEquals( $isKnown,
$title->isAlwaysKnown() );
659 [
'Some nonexistent page',
false ],
662 [
'Special:BlankPage',
true ],
663 [
'Special:SomeNonexistentSpecialPage',
false ],
664 [
'MediaWiki:Parentheses',
true ],
665 [
'MediaWiki:Some nonexistent message',
false ],
676 $this->assertEquals( $isValid,
$title->isValid(),
$title->getPrefixedText() );
686 [ Title::makeTitle( -33,
'Test' ),
false ],
687 [ Title::makeTitle( 77663399,
'Test' ),
false ],
695 $title = Title::makeTitle(
NS_MAIN,
'Interwiki link',
'',
'externalwiki' );
696 $this->assertTrue(
$title->isAlwaysKnown() );
704 $linkCache = MediaWikiServices::getInstance()->getLinkCache();
708 $page->doEditContent(
new WikitextContent(
'Some [[link]]' ),
'summary' );
714 $linkCache->clearLink(
$title );
715 $linkCache->addBadLinkObj(
$title );
720 'exists() should rely on link cache unless GAID_FOR_UPDATE is used'
724 $title->exists( Title::GAID_FOR_UPDATE ),
725 'exists() should re-query database when GAID_FOR_UPDATE is used'
731 'User page has talk page' => [
734 'Talke page has talk page' => [
737 'Special page cannot have talk page' => [
740 'Virtual namespace cannot have talk page' => [
754 $actual =
$title->canHaveTalkPage();
755 $this->assertSame( $expected, $actual,
$title->getPrefixedDBkey() );
760 [ Title::makeTitle(
NS_MAIN,
'Test' ), Title::makeTitle(
NS_TALK,
'Test' ) ],
761 [ Title::makeTitle(
NS_TALK,
'Test' ), Title::makeTitle(
NS_TALK,
'Test' ) ],
770 $talk =
$title->getTalkPage();
772 $expected->getPrefixedDBKey(),
773 $talk->getPrefixedDBKey(),
774 $title->getPrefixedDBKey()
783 $talk =
$title->getTalkPageIfDefined();
784 $this->assertInstanceOf(
787 $title->getPrefixedDBKey()
794 [ Title::makeTitle(
NS_MEDIA,
'Test' ) ],
803 $talk =
$title->getTalkPageIfDefined();
806 $title->getPrefixedDBKey()
812 [ Title::makeTitle(
NS_MAIN,
'Test' ),
'foo' ],
813 [ Title::makeTitle(
NS_TALK,
'Test',
'foo' ),
'' ],
814 [ Title::makeTitle(
NS_CATEGORY,
'Test',
'foo' ),
'bar' ],
815 [ Title::makeTitle(
NS_MAIN,
'Test1',
'',
'interwiki' ),
'baz' ]
825 'InterwikiLoadPrefix' => [
826 function ( $prefix, &$iwdata ) {
827 if ( $prefix ===
'interwiki' ) {
829 'iw_url' =>
'http://example.com/',
839 $fragmentTitle =
$title->createFragmentTarget( $fragment );
841 $this->assertEquals(
$title->getNamespace(), $fragmentTitle->getNamespace() );
842 $this->assertEquals(
$title->getText(), $fragmentTitle->getText() );
843 $this->assertEquals(
$title->getInterwiki(), $fragmentTitle->getInterwiki() );
844 $this->assertEquals( $fragment, $fragmentTitle->getFragment() );
851 Title::makeTitle(
NS_MAIN,
'Foo bar' ),
856 Title::makeTitle(
NS_USER,
'Foo bar' ),
866 Title::makeTitle(
NS_MAIN,
'Foo bar',
'fragment' ),
871 Title::makeTitle(
NS_MEDIA,
'Foo bar' ),
876 Title::makeTitle( 100777,
'Foo bar' ),
877 'Special:Badtitle/NS100777:Foo bar'
887 $this->assertEquals( $expected,
$title->getPrefixedText() );
894 Title::makeTitle(
NS_MAIN,
'Foo_bar' ),
899 Title::makeTitle(
NS_USER,
'Foo_bar' ),
909 Title::makeTitle(
NS_MAIN,
'Foo_bar',
'fragment' ),
914 Title::makeTitle(
NS_MEDIA,
'Foo_bar' ),
919 Title::makeTitle( 100777,
'Foo_bar' ),
920 'Special:Badtitle/NS100777:Foo_bar'
930 $this->assertEquals( $expected,
$title->getPrefixedDBkey() );
942 'wgFragmentMode' => [
'html5' ],
943 'wgExternalInterwikiFragmentMode' =>
'legacy',
946 $dbw->insert(
'interwiki',
950 'iw_url' =>
'http://de.wikipedia.org/wiki/',
951 'iw_api' =>
'http://de.wikipedia.org/w/api.php',
952 'iw_wikiid' =>
'dewiki',
958 'iw_url' =>
'http://zzwiki.org/wiki/',
959 'iw_api' =>
'http://zzwiki.org/w/api.php',
960 'iw_wikiid' =>
'zzwiki',
969 $title = Title::newFromText( $titleStr );
970 self::assertEquals( $expected,
$title->getFragmentForURL() );
972 $dbw->delete(
'interwiki',
'*', __METHOD__ );
978 [
'Foo#ümlåût',
'#ümlåût' ],
979 [
'de:Foo#Bå®',
'#Bå®' ],
980 [
'zz:Foo#тест',
'#.D1.82.D0.B5.D1.81.D1.82' ],
995 $title = Title::newFromText( $textForm );
996 $this->assertSame( $expected,
$title->isRawHtmlMessage() );
1001 [
'MediaWiki:Foobar',
true ],
1002 [
'MediaWiki:Foo bar',
true ],
1003 [
'MediaWiki:Foo-bar',
true ],
1004 [
'MediaWiki:foo bar',
true ],
1005 [
'MediaWiki:foo-bar',
true ],
1006 [
'MediaWiki:foobar',
true ],
1007 [
'MediaWiki:some-other-message',
false ],
1008 [
'Main Page',
false ],
1014 Title::newFromText(
'Main Page' ),
1015 Title::newFromText(
'Main Page' ),
1019 Title::newFromText(
'Main Page' ),
1020 Title::newFromText(
'Not The Main Page' ),
1024 Title::newFromText(
'Main Page' ),
1025 Title::newFromText(
'Project:Main Page' ),
1029 Title::newFromText(
'File:Example.png' ),
1030 Title::newFromText(
'Image:Example.png' ),
1034 Title::newFromText(
'Special:Version' ),
1035 Title::newFromText(
'Special:Version' ),
1039 Title::newFromText(
'Special:Version' ),
1040 Title::newFromText(
'Special:Recentchanges' ),
1044 Title::newFromText(
'Special:Version' ),
1045 Title::newFromText(
'Main Page' ),
1049 Title::makeTitle(
NS_MAIN,
'Foo',
'',
'' ),
1050 Title::makeTitle(
NS_MAIN,
'Foo',
'',
'' ),
1054 Title::makeTitle(
NS_MAIN,
'Foo',
'',
'' ),
1055 Title::makeTitle(
NS_MAIN,
'Bar',
'',
'' ),
1059 Title::makeTitle(
NS_MAIN,
'Foo',
'',
'' ),
1060 Title::makeTitle(
NS_TALK,
'Foo',
'',
'' ),
1064 Title::makeTitle(
NS_MAIN,
'Foo',
'Bar',
'' ),
1065 Title::makeTitle(
NS_MAIN,
'Foo',
'Bar',
'' ),
1069 Title::makeTitle(
NS_MAIN,
'Foo',
'Bar',
'' ),
1070 Title::makeTitle(
NS_MAIN,
'Foo',
'Baz',
'' ),
1074 Title::makeTitle(
NS_MAIN,
'Foo',
'Bar',
'' ),
1075 Title::makeTitle(
NS_MAIN,
'Foo',
'',
'' ),
1079 Title::makeTitle(
NS_MAIN,
'Foo',
'',
'baz' ),
1080 Title::makeTitle(
NS_MAIN,
'Foo',
'',
'baz' ),
1084 Title::makeTitle(
NS_MAIN,
'Foo',
'',
'' ),
1085 Title::makeTitle(
NS_MAIN,
'Foo',
'',
'baz' ),
1097 $firstValue->
equals( $secondValue )
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Class for viewing MediaWiki article and history.
Caches user genders when needed to use correct namespace aliases.
testFixSpecialNameRetainsParameter( $text, $expectedParam)
provideSpecialNamesWithAndWithoutParameter Title::fixSpecialName
testIsAlwaysKnown( $page, $isKnown)
Title::isAlwaysKnown provideIsAlwaysKnown.
testGetFragment( $full, $fragment)
Title::getFragment provideGetFragment.
flattenErrorsArray( $errors)
testGetPageViewLanguage( $expected, $titleText, $contLang, $lang, $variant, $msg='')
provideGetPageViewLanguage Title::getPageViewLanguage
static provideBaseTitleCases()
static provideConvertByteClassToUnicodeClass()
testNewFromLinkTarget(LinkTarget $value)
Title::newFromLinkTarget provideNewFromTitleValue.
testGetFragmentForURL( $titleStr, $expected)
Title::getFragmentForURL provideGetFragmentForURL.
testGetTitleValue( $text)
Title::getTitleValue provideGetTitleValue.
testWgWhitelistReadRegexp( $whitelistRegexp, $source, $action, $expected)
Auth-less test of Title::userCan.
static provideTestIsValidMoveOperation()
testGetPrefixedDBKey(Title $title, $expected)
Title::getPrefixedDBKey provideGetPrefixedDBKey.
testIsValidMoveOperation( $source, $target, $expected)
Auth-less test of Title::isValidMoveOperation.
provideCreateFragmentTitle()
testGetBaseText( $title, $expected, $msg='')
provideBaseTitleCases Title::getBaseText
testGetTalkPageIfDefined_good(Title $title)
provideGetTalkPage_good Title::getTalkPageIfDefined
static provideRootTitleCases()
static provideGetTalkPage_bad()
testIsRawHtmlMessage( $textForm, $expected)
Title::isRawHtmlMessage provideIsRawHtmlMessage.
testNewFromTitleValue(TitleValue $value)
Title::newFromTitleValue provideNewFromTitleValue.
static provideIsAlwaysKnown()
static provideGetTitleValue()
static provideGetFragment()
testSecureAndSplitInvalid( $text, $expectedErrorMessage)
See also mediawiki.Title.test.js Title::secureAndSplit provideInvalidSecureAndSplit.
testGetRootText( $title, $expected, $msg='')
provideRootTitleCases Title::getRootText
dataWgWhitelistReadRegexp()
Provides test parameter values for testWgWhitelistReadRegexp()
testGetTalkPage_good(Title $title, Title $expected)
provideGetTalkPage_good Title::getTalkPage
provideIsRawHtmlMessage()
testEquals(Title $firstValue, $secondValue, $expectedSame)
Title::equals provideEquals.
testConvertByteClassToUnicodeClass( $byteClass, $unicodeClass)
provideConvertByteClassToUnicodeClass Title::convertByteClassToUnicodeClass
testGetSubpageText( $title, $expected, $msg='')
provideGetPrefixedDBKey()
static provideSubpageTitleCases()
testCanHaveTalkPage(Title $title, $expected)
provideCanHaveTalkPage Title::canHaveTalkPage
testGetPrefixedText(Title $title, $expected)
Title::getPrefixedText provideGetPrefixedText.
static provideGetPageViewLanguage()
testLegalChars()
Title::legalChars.
testExists()
Title::exists.
testNewFromLinkTarget_clone()
Title::newFromLinkTarget.
testSecureAndSplitValid( $text)
See also mediawiki.Title.test.js Title::secureAndSplit provideValidSecureAndSplit.
testIsAlwaysKnownOnInterwiki()
Title::isAlwaysKnown.
static provideInvalidSecureAndSplit()
static provideNewFromTitleValue()
static provideValidSecureAndSplit()
testGetTalkPageIfDefined_bad(Title $title)
provideGetTalkPage_bad Title::getTalkPageIfDefined
testCreateFragmentTitle(Title $title, $fragment)
Title::createFragmentTarget provideCreateFragmentTitle.
provideGetFragmentForURL()
static provideSpecialNamesWithAndWithoutParameter()
testIsValid(Title $title, $isValid)
Title::isValid provideIsValid.
static provideGetTalkPage_good()
Represents a page (or page fragment) title within MediaWiki.
Represents a title within MediaWiki.
equals(Title $title)
Compare with another title.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Content object for wiki text pages.
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
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)
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. 'ImgAuthModifyHeaders':Executed just before a file is streamed to a user via img_auth.php, allowing headers to be modified beforehand. $title:LinkTarget object & $headers:HTTP headers(name=> value, names are case insensitive). Two headers get special handling:If-Modified-Since(value must be a valid HTTP date) and Range(must be of the form "bytes=(\d*-\d*)") will be honored when streaming the file. '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
namespace and then decline to actually register it file or subcat img or subcat $title
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 null
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
return true to allow those checks to and false if checking is done remove or add to the links of a group of changes in EnhancedChangesList Hook subscribers can return false to omit this line from recentchanges use this to change the tables headers change it to an object instance and return false override the list derivative used the name of the old file & $article
return true to allow those checks to and false if checking is done & $user
processing should stop and the error should be shown to the user * false
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
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