14 parent::__construct(
$name, $data, $dataName );
16 $this->tablesUsed = array_merge(
37 $this->pages_to_delete = [];
43 foreach ( $this->pages_to_delete
as $p ) {
48 $p->doDeleteArticle(
"testing done." );
63 if ( is_string(
$title ) ) {
70 $this->pages_to_delete[] = $p;
87 $content = ContentHandler::makeContent( $text,
$page->getTitle(), $model );
97 $page = $this->
newPage(
"WikiPageTest_testDoEditContent" );
100 $content = ContentHandler::makeContent(
101 "[[Lorem ipsum]] dolor sit amet, consetetur sadipscing elitr, sed diam "
102 .
" nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.",
109 $this->assertTrue(
$title->getArticleID() > 0,
"Title object should have new page id" );
110 $this->assertTrue(
$page->getId() > 0,
"WikiPage should have new page id" );
111 $this->assertTrue(
$title->exists(),
"Title object should indicate that the page now exists" );
112 $this->assertTrue(
$page->exists(),
"WikiPage object should indicate that the page now exists" );
114 $id =
$page->getId();
116 # ------------------------
118 $res =
$dbr->select(
'pagelinks',
'*', [
'pl_from' => $id ] );
119 $n =
$res->numRows();
122 $this->assertEquals( 1, $n,
'pagelinks should contain one link from the page' );
124 # ------------------------
127 $retrieved =
$page->getContent();
128 $this->assertTrue(
$content->equals( $retrieved ),
'retrieved content doesn\'t equal original' );
130 # ------------------------
131 $content = ContentHandler::makeContent(
132 "At vero eos et accusam et justo duo [[dolores]] et ea rebum. "
133 .
"Stet clita kasd [[gubergren]], no sea takimata sanctus est.",
138 $page->doEditContent( $content,
"testing 2" );
140 # ------------------------
143 $retrieved =
$page->getContent();
144 $this->assertTrue( $content->equals( $retrieved ),
'retrieved content doesn\'t equal original' );
146 # ------------------------
148 $res = $dbr->select(
'pagelinks',
'*', [
'pl_from' => $id ] );
149 $n =
$res->numRows();
152 $this->assertEquals( 2, $n,
'pagelinks should contain two links from the page' );
168 $text =
"[[Lorem ipsum]] dolor sit amet, consetetur sadipscing elitr, sed diam "
169 .
" nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.";
171 $page->doEdit( $text,
"[[testing]] 1" );
173 $this->assertTrue(
$title->getArticleID() > 0,
"Title object should have new page id" );
174 $this->assertTrue(
$page->getId() > 0,
"WikiPage should have new page id" );
175 $this->assertTrue(
$title->exists(),
"Title object should indicate that the page now exists" );
176 $this->assertTrue(
$page->exists(),
"WikiPage object should indicate that the page now exists" );
178 $id =
$page->getId();
180 # ------------------------
182 $res =
$dbr->select(
'pagelinks',
'*', [
'pl_from' => $id ] );
183 $n =
$res->numRows();
186 $this->assertEquals( 1, $n,
'pagelinks should contain one link from the page' );
188 # ------------------------
191 $retrieved =
$page->getText();
192 $this->assertEquals( $text, $retrieved,
'retrieved text doesn\'t equal original' );
194 # ------------------------
195 $text =
"At vero eos et accusam et justo duo [[dolores]] et ea rebum. "
196 .
"Stet clita kasd [[gubergren]], no sea takimata sanctus est.";
198 $page->doEdit( $text,
"testing 2" );
200 # ------------------------
203 $retrieved =
$page->getText();
204 $this->assertEquals( $text, $retrieved,
'retrieved text doesn\'t equal original' );
206 # ------------------------
208 $res =
$dbr->select(
'pagelinks',
'*', [
'pl_from' => $id ] );
209 $n =
$res->numRows();
212 $this->assertEquals( 2, $n,
'pagelinks should contain two links from the page' );
222 "WikiPageTest_testDoQuickEditContent",
227 $content = ContentHandler::makeContent(
234 # ---------------------
236 $this->assertTrue(
$content->equals(
$page->getContent() ) );
244 "WikiPageTest_testDoDeleteArticle",
245 "[[original text]] foo",
248 $id =
$page->getId();
250 $page->doDeleteArticle(
"testing deletion" );
253 $page->getTitle()->getArticleID() > 0,
254 "Title object should now have page id 0"
256 $this->assertFalse(
$page->getId() > 0,
"WikiPage should now have page id 0" );
259 "WikiPage::exists should return false after page was deleted"
263 "WikiPage::getContent should return null after page was deleted"
267 "WikiPage::getText should return false after page was deleted"
273 "Title::exists should return false after page was deleted"
282 # ------------------------
284 $res =
$dbr->select(
'pagelinks',
'*', [
'pl_from' => $id ] );
285 $n =
$res->numRows();
288 $this->assertEquals( 0, $n,
'pagelinks should contain no more links from the page' );
296 "WikiPageTest_testDoDeleteArticle",
297 "[[original text]] foo",
300 $id =
$page->getId();
304 $page->doDeleteUpdates( $id );
312 # ------------------------
314 $res =
$dbr->select(
'pagelinks',
'*', [
'pl_from' => $id ] );
315 $n =
$res->numRows();
318 $this->assertEquals( 0, $n,
'pagelinks should contain no more links from the page' );
325 $page = $this->
newPage(
"WikiPageTest_testGetRevision" );
328 $this->assertNull(
$rev );
335 $this->assertEquals(
$page->getLatest(),
$rev->getId() );
336 $this->assertEquals(
"some text",
$rev->getContent()->getNativeData() );
343 $page = $this->
newPage(
"WikiPageTest_testGetContent" );
352 $this->assertEquals(
"some text",
$content->getNativeData() );
363 $text =
$page->getText();
364 $this->assertFalse( $text );
369 $text =
$page->getText();
370 $this->assertEquals(
"some text", $text );
379 if ( !$wgContentHandlerUseDB ) {
380 $this->markTestSkipped(
'$wgContentHandlerUseDB is disabled' );
384 "WikiPageTest_testGetContentModel",
399 if ( !$wgContentHandlerUseDB ) {
400 $this->markTestSkipped(
'$wgContentHandlerUseDB is disabled' );
404 "WikiPageTest_testGetContentHandler",
410 $this->assertEquals(
'JavaScriptContentHandler', get_class(
$page->getContentHandler() ) );
418 $this->assertFalse(
$page->exists() );
422 $this->assertTrue(
$page->exists() );
425 $this->assertTrue( $page->exists() );
429 $this->assertFalse( $page->exists() );
431 $page =
new WikiPage( $page->getTitle() );
432 $this->assertFalse( $page->exists() );
437 [
'WikiPageTest_testHasViewableContent',
false,
true ],
438 [
'Special:WikiPageTest_testHasViewableContent',
false ],
439 [
'MediaWiki:WikiPageTest_testHasViewableContent',
false ],
440 [
'Special:Userlogin',
true ],
441 [
'MediaWiki:help',
true ],
451 $this->assertEquals( $viewable,
$page->hasViewableContent() );
455 $this->assertTrue(
$page->hasViewableContent() );
458 $this->assertTrue( $page->hasViewableContent() );
466 'WikiPageTest_testGetRedirectTarget_2',
468 "#REDIRECT [[hello world]]",
480 'wgCapitalLinks' =>
true,
485 # sanity check, because this test seems to fail for no reason for some people.
486 $c =
$page->getContent();
487 $this->assertEquals(
'WikitextContent', get_class( $c ) );
489 # now, test the actual redirect
490 $t =
$page->getRedirectTarget();
491 $this->assertEquals( $target, is_null(
$t ) ? null :
$t->getPrefixedText() );
500 $this->assertEquals( !is_null( $target ),
$page->isRedirect() );
507 [
'WikiPageTest_testIsCountable',
513 [
'WikiPageTest_testIsCountable',
521 [
'WikiPageTest_testIsCountable',
527 [
'WikiPageTest_testIsCountable',
535 [
'WikiPageTest_testIsCountable',
541 [
'WikiPageTest_testIsCountable',
549 [
'WikiPageTest_testIsCountable',
555 [
'WikiPageTest_testIsCountable',
561 [
'WikiPageTest_testIsCountable',
569 [
'Talk:WikiPageTest_testIsCountable',
575 [
'Talk:WikiPageTest_testIsCountable',
581 [
'Talk:WikiPageTest_testIsCountable',
589 [
'MediaWiki:WikiPageTest_testIsCountable.js',
595 [
'MediaWiki:WikiPageTest_testIsCountable.js',
601 [
'MediaWiki:WikiPageTest_testIsCountable.js',
621 if ( !$wgContentHandlerUseDB
623 && ContentHandler::getDefaultModelFor(
$title ) != $model
625 $this->markTestSkipped(
"Can not use non-default content model $model for "
626 .
$title->getPrefixedDBkey() .
" with \$wgContentHandlerUseDB disabled." );
631 $editInfo =
$page->prepareContentForEdit(
$page->getContent() );
633 $v =
$page->isCountable();
634 $w =
$page->isCountable( $editInfo );
639 "isCountable( null ) returned unexpected value " . var_export( $v,
true )
640 .
" instead of " . var_export( $expected,
true )
641 .
" in mode `$mode` for text \"$text\""
647 "isCountable( \$editInfo ) returned unexpected value " . var_export( $v,
true )
648 .
" instead of " . var_export( $expected,
true )
649 .
" in mode `$mode` for text \"$text\""
665 $page = $this->
createPage(
'WikiPageTest_testGetParserOutput', $text, $model );
667 $opt =
$page->makeParserOptions(
'canonical' );
668 $po =
$page->getParserOutput( $opt );
669 $text = $po->getText();
671 $text = trim( preg_replace(
'/<!--.*?-->/sm',
'', $text ) ); # strip injected comments
672 $text = preg_replace(
'!\s*(</p>)!sm',
'\1', $text ); # don
't let tidy confuse us
674 $this->assertEquals( $expectedHtml, $text );
682 public function testGetParserOutput_nonexisting() {
686 $page = new WikiPage( new Title( "WikiPageTest_testGetParserOutput_nonexisting_$count" ) );
688 $opt = new ParserOptions();
689 $po = $page->getParserOutput( $opt );
691 $this->assertFalse( $po, "getParserOutput() shall return false for non-existing pages." );
697 public function testGetParserOutput_badrev() {
698 $page = $this->createPage( 'WikiPageTest_testGetParserOutput
', "dummy", CONTENT_MODEL_WIKITEXT );
700 $opt = new ParserOptions();
701 $po = $page->getParserOutput( $opt, $page->getLatest() + 1234 );
703 // @todo would be neat to also test deleted revision
705 $this->assertFalse( $po, "getParserOutput() shall return false for non-existing revisions." );
708 public static $sections =
722 public function dataReplaceSection() {
723 // NOTE: assume the Help namespace to contain wikitext
725 [ 'Help:WikiPageTest_testReplaceSection
',
726 CONTENT_MODEL_WIKITEXT,
727 WikiPageTest::$sections,
731 trim( preg_replace( '/^Intro/sm
', 'No more
', WikiPageTest::$sections ) )
733 [ 'Help:WikiPageTest_testReplaceSection
',
734 CONTENT_MODEL_WIKITEXT,
735 WikiPageTest::$sections,
741 [ 'Help:WikiPageTest_testReplaceSection
',
742 CONTENT_MODEL_WIKITEXT,
743 WikiPageTest::$sections,
745 "== TEST ==\nmore fun",
747 trim( preg_replace( '/^== test ==.*== foo ==/sm
',
748 "== TEST ==\nmore fun\n\n== foo ==",
749 WikiPageTest::$sections ) )
751 [ 'Help:WikiPageTest_testReplaceSection
',
752 CONTENT_MODEL_WIKITEXT,
753 WikiPageTest::$sections,
757 trim( WikiPageTest::$sections )
759 [ 'Help:WikiPageTest_testReplaceSection
',
760 CONTENT_MODEL_WIKITEXT,
761 WikiPageTest::$sections,
765 trim( WikiPageTest::$sections ) . "\n\n== New ==\n\nNo more"
774 public function testReplaceSectionContent( $title, $model, $text, $section,
775 $with, $sectionTitle, $expected
777 $page = $this->createPage( $title, $text, $model );
779 $content = ContentHandler::makeContent( $with, $page->getTitle(), $page->getContentModel() );
780 $c = $page->replaceSectionContent( $section, $content, $sectionTitle );
782 $this->assertEquals( $expected, is_null( $c ) ? null : trim( $c->getNativeData() ) );
789 public function testReplaceSectionAtRev( $title, $model, $text, $section,
790 $with, $sectionTitle, $expected
792 $page = $this->createPage( $title, $text, $model );
793 $baseRevId = $page->getLatest();
795 $content = ContentHandler::makeContent( $with, $page->getTitle(), $page->getContentModel() );
796 $c = $page->replaceSectionAtRev( $section, $content, $sectionTitle, $baseRevId );
798 $this->assertEquals( $expected, is_null( $c ) ? null : trim( $c->getNativeData() ) );
801 /* @todo FIXME: fix this!
802 public function testGetUndoText() {
803 $this->markTestSkippedIfNoDiff3();
806 $page = $this->createPage( "WikiPageTest_testGetUndoText", $text );
807 $rev1 = $page->getRevision();
810 $page->doEditContent(
811 ContentHandler::makeContent( $text, $page->getTitle() ),
814 $rev2 = $page->getRevision();
816 $text .= "\n\nthree";
817 $page->doEditContent(
818 ContentHandler::makeContent( $text, $page->getTitle() ),
819 "adding section three"
821 $rev3 = $page->getRevision();
824 $page->doEditContent(
825 ContentHandler::makeContent( $text, $page->getTitle() ),
826 "adding section four"
828 $rev4 = $page->getRevision();
831 $page->doEditContent(
832 ContentHandler::makeContent( $text, $page->getTitle() ),
833 "adding section five"
835 $rev5 = $page->getRevision();
838 $page->doEditContent(
839 ContentHandler::makeContent( $text, $page->getTitle() ),
842 $rev6 = $page->getRevision();
844 $undo6 = $page->getUndoText( $rev6 );
845 if ( $undo6 === false ) $this->fail( "getUndoText failed for rev6" );
846 $this->assertEquals( "one\n\ntwo\n\nthree\n\nfour\n\nfive", $undo6 );
848 $undo3 = $page->getUndoText( $rev4, $rev2 );
849 if ( $undo3 === false ) $this->fail( "getUndoText failed for rev4..rev2" );
850 $this->assertEquals( "one\n\ntwo\n\nfive", $undo3 );
852 $undo2 = $page->getUndoText( $rev2 );
853 if ( $undo2 === false ) $this->fail( "getUndoText failed for rev2" );
854 $this->assertEquals( "one\n\nfive", $undo2 );
862 public function broken_testDoRollback() {
864 $admin->setName( "Admin" );
867 $page = $this->newPage( "WikiPageTest_testDoRollback" );
868 $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle() ),
869 "section one", EDIT_NEW, false, $admin );
872 $user1->setName( "127.0.1.11" );
874 $page = new WikiPage( $page->getTitle() );
875 $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle() ),
876 "adding section two", 0, false, $user1 );
879 $user2->setName( "127.0.2.13" );
880 $text .= "\n\nthree";
881 $page = new WikiPage( $page->getTitle() );
882 $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle() ),
883 "adding section three", 0, false, $user2 );
885 # we are having issues with doRollback spuriously failing. Apparently
886 # the last revision somehow goes missing or not committed under some
887 # circumstances. So, make sure the last revision has the right user name.
888 $dbr = wfGetDB( DB_SLAVE );
889 $this->assertEquals( 3, Revision::countByPageId( $dbr, $page->getId() ) );
891 $page = new WikiPage( $page->getTitle() );
892 $rev3 = $page->getRevision();
893 $this->assertEquals( '127.0.2.13
', $rev3->getUserText() );
895 $rev2 = $rev3->getPrevious();
896 $this->assertEquals( '127.0.1.11
', $rev2->getUserText() );
898 $rev1 = $rev2->getPrevious();
899 $this->assertEquals( 'Admin
', $rev1->getUserText() );
901 # now, try the actual rollback
902 $admin->addGroup( "sysop" ); # XXX: make the test user a sysop...
903 $token = $admin->getEditToken(
904 [ $page->getTitle()->getPrefixedText(), $user2->getName() ],
907 $errors = $page->doRollback(
917 $this->fail( "Rollback failed:\n" . print_r( $errors, true )
918 . ";\n" . print_r( $details, true ) );
921 $page = new WikiPage( $page->getTitle() );
922 $this->assertEquals( $rev2->getSha1(), $page->getRevision()->getSha1(),
923 "rollback did not revert to the correct revision" );
924 $this->assertEquals( "one\n\ntwo", $page->getContent()->getNativeData() );
931 public function testDoRollback() {
933 $admin->setName( "Admin" );
936 $page = $this->newPage( "WikiPageTest_testDoRollback" );
937 $page->doEditContent(
938 ContentHandler::makeContent( $text, $page->getTitle(), CONTENT_MODEL_WIKITEXT ),
944 $rev1 = $page->getRevision();
947 $user1->setName( "127.0.1.11" );
949 $page = new WikiPage( $page->getTitle() );
950 $page->doEditContent(
951 ContentHandler::makeContent( $text, $page->getTitle(), CONTENT_MODEL_WIKITEXT ),
952 "adding section two",
958 # now, try the rollback
959 $admin->addGroup( "sysop" ); # XXX: make the test user a sysop...
960 $token = $admin->getEditToken(
961 [ $page->getTitle()->getPrefixedText(), $user1->getName() ],
964 $errors = $page->doRollback(
974 $this->fail( "Rollback failed:\n" . print_r( $errors, true )
975 . ";\n" . print_r( $details, true ) );
978 $page = new WikiPage( $page->getTitle() );
979 $this->assertEquals( $rev1->getSha1(), $page->getRevision()->getSha1(),
980 "rollback did not revert to the correct revision" );
981 $this->assertEquals( "one", $page->getContent()->getNativeData() );
987 public function testDoRollbackFailureSameContent() {
989 $admin->setName( "Admin" );
990 $admin->addGroup( "sysop" ); # XXX: make the test user a sysop...
993 $page = $this->newPage( "WikiPageTest_testDoRollback" );
994 $page->doEditContent(
995 ContentHandler::makeContent( $text, $page->getTitle(), CONTENT_MODEL_WIKITEXT ),
1001 $rev1 = $page->getRevision();
1003 $user1 = new User();
1004 $user1->setName( "127.0.1.11" );
1005 $user1->addGroup( "sysop" ); # XXX: make the test user a sysop...
1007 $page = new WikiPage( $page->getTitle() );
1008 $page->doEditContent(
1009 ContentHandler::makeContent( $text, $page->getTitle(), CONTENT_MODEL_WIKITEXT ),
1010 "adding section two",
1016 # now, do a the rollback from the same user was doing the edit before
1017 $resultDetails = [];
1018 $token = $user1->getEditToken(
1019 [ $page->getTitle()->getPrefixedText(), $user1->getName() ],
1022 $errors = $page->doRollback(
1024 "testing revert same user",
1031 $this->assertEquals( [], $errors, "Rollback failed same user" );
1033 # now, try the rollback
1034 $resultDetails = [];
1035 $token = $admin->getEditToken(
1036 [ $page->getTitle()->getPrefixedText(), $user1->getName() ],
1039 $errors = $page->doRollback(
1049 '127.0.1.11
', 'Admin
' ] ], $errors, "Rollback not failed" );
1051 $page = new WikiPage( $page->getTitle() );
1052 $this->assertEquals( $rev1->getSha1(), $page->getRevision()->getSha1(),
1053 "rollback did not revert to the correct revision" );
1054 $this->assertEquals( "one", $page->getContent()->getNativeData() );
1057 public static function provideGetAutosummary() {
1060 'Hello
there, world!
',
1061 '#REDIRECT [[Foo]]
',
1063 '/^Redirected
page .*Foo/
'
1070 '/^Created
page .*Hello/
'
1074 'Hello
there, world!
',
1081 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
1082 eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
1083 voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet
1084 clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
',
1087 '/^Replaced .*Hello/
'
1103 public function testGetAutosummary( $old, $new, $flags, $expected ) {
1104 $this->hideDeprecated( "WikiPage::getAutosummary" );
1106 $page = $this->newPage( "WikiPageTest_testGetAutosummary" );
1108 $summary = $page->getAutosummary( $old, $new, $flags );
1110 $this->assertTrue( (bool)preg_match( $expected, $summary ),
1111 "Autosummary didn't match expected pattern $expected:
$summary" );
1114 public static function provideGetAutoDeleteReason() {
1124 [ "first edit
", null ],
1126 "/first edit.*only contributor/
",
1132 [ "first edit
", null ],
1133 [ "second edit
", null ],
1135 "/second edit.*only contributor/
",
1141 [ "first edit
", "127.0.2.22
" ],
1142 [ "second edit
", "127.0.3.33
" ],
1152 . "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
"
1153 . " nonumy eirmod tempor invidunt ut labore et dolore magna
"
1154 . "aliquyam erat, sed diam voluptua. At vero eos et accusam
"
1155 . "et justo duo dolores et ea rebum. Stet clita kasd gubergren,
"
1156 . "no sea takimata sanctus est Lorem ipsum dolor sit amet.
'",
1160 '/first edit:.*\.\.\.
"/',
1166 [ "first edit
", "127.0.2.22
" ],
1167 [ "", "127.0.3.33
" ],
1169 "/before blanking.*first edit/
",
1180 public function testGetAutoDeleteReason( $edits, $expectedResult, $expectedHistory ) {
1183 // NOTE: assume Help namespace to contain wikitext
1184 $page = $this->newPage( "Help:WikiPageTest_testGetAutoDeleteReason
" );
1188 foreach ( $edits as $edit ) {
1191 if ( !empty( $edit[1] ) ) {
1192 $user->setName( $edit[1] );
1197 $content = ContentHandler::makeContent( $edit[0], $page->getTitle(), $page->getContentModel() );
1199 $page->doEditContent( $content, "test edit $c
", $c < 2 ? EDIT_NEW : 0, false, $user );
1204 $reason = $page->getAutoDeleteReason( $hasHistory );
1206 if ( is_bool( $expectedResult ) || is_null( $expectedResult ) ) {
1207 $this->assertEquals( $expectedResult, $reason );
1209 $this->assertTrue( (bool)preg_match( $expectedResult, $reason ),
1210 "Autosummary didn
't match expected pattern $expectedResult: $reason" );
1213 $this->assertEquals( $expectedHistory, $hasHistory,
1214 "expected \$hasHistory to be " . var_export( $expectedHistory, true ) );
1216 $page->doDeleteArticle( "done" );
1219 public static function providePreSaveTransform() {
1221 [ 'hello
this is ~~~
',
1222 "hello this is [[Special:Contributions/127.0.0.1|127.0.0.1]]",
1224 [ 'hello \
'\'this\
'\' is <nowiki>~~~</nowiki>
',
1225 'hello \
'\'this\
'\' is <nowiki>~~~</nowiki>
',
1233 public function testWikiPageFactory() {
1234 $title = Title::makeTitle( NS_FILE, 'Someimage.png
' );
1235 $page = WikiPage::factory( $title );
1236 $this->assertEquals( 'WikiFilePage', get_class( $page ) );
1238 $title = Title::makeTitle( NS_CATEGORY, 'SomeCategory
' );
1239 $page = WikiPage::factory( $title );
1242 $title = Title::makeTitle( NS_MAIN, 'SomePage
' );
1243 $page = WikiPage::factory( $title );
1244 $this->assertEquals( 'WikiPage', get_class( $page ) );
static provideIsCountable()
loadParamsAndArgs($self=null, $opts=null, $args=null)
Process command line arguments $mOptions becomes an array with keys set to the option names $mArgs be...
static provideGetRedirectTarget()
wfGetDB($db, $groups=[], $wiki=false)
Get a Database object.
the array() calling protocol came about after MediaWiki 1.4rc1.
const CONTENT_MODEL_WIKITEXT
processing should stop and the error should be shown to the user * false
testIsCountable($title, $model, $text, $mode, $expected)
provideIsCountable WikiPage::isCountable
static provideHasViewableContent()
testDoQuickEditContent()
WikiPage::doQuickEditContent.
has been added to your &Future changes to this page and its associated Talk page will be listed there
testDoEditContent()
WikiPage::doEditContent.
static newFromText($text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Represents a title within MediaWiki.
when a variable name is used in a it is silently declared as a new local masking the global
testGetText()
WikiPage::getText.
testGetRevision()
WikiPage::getRevision.
$wgContentHandlerUseDB
Set to false to disable use of the database fields introduced by the ContentHandler facility...
testGetContentModel()
WikiPage::getContentModel.
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
static provideGetParserOutput()
Some quick notes on the file repository architecture Functionality is
static singleton()
Get an instance of this class.
__construct($name=null, array $data=[], $dataName= '')
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add etc
doDeleteArticle($reason, $suppress=false, $u1=null, $u2=null, &$error= '', User $user=null)
Same as doDeleteArticleReal(), but returns a simple boolean.
Maintenance script that runs pending jobs.
testGetContent()
WikiPage::getContent.
testIsRedirect($title, $model, $text, $target)
provideGetRedirectTarget WikiPage::isRedirect
Allows to change the fields on the form that will be generated are created Can be used to omit specific feeds from being outputted You must not use this hook to add use OutputPage::addFeedLink() instead.&$feedLinks conditions will AND in the final query as a Content object as a Content object $title
newPage($title, $model=null)
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev
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
Special handling for file pages.
CONTENT_MODEL_JAVASCRIPT
Uploads have to be specially set up to be secure.
testGetRedirectTarget($title, $model, $text, $target)
provideGetRedirectTarget WikiPage::getRedirectTarget
testDoEdit()
WikiPage::doEdit.
Class representing a MediaWiki article and history.
testGetContentHandler()
WikiPage::getContentHandler.
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
testGetParserOutput($model, $text, $expectedHtml)
provideGetParserOutput WikiPage::getParserOutput
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content $content
ContentHandler Database ^— important, causes temporary tables to be used instead of the real database...
This list may contain false positives That usually means there is additional text with links below the first Each row contains links to the first and second redirect
Some quick notes on the file repository architecture Functionality as driven by data model *The repository object stores configuration information about a file storage method *The file object is a process local cache of information about a particular file Thus the file object is the primary public entry point for obtaining information about since access via the file object can be cached
testDoDeleteUpdates()
WikiPage::doDeleteUpdates.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached one of or reset my talk page
testDoDeleteArticle()
WikiPage::doDeleteArticle.
testHasViewableContent($title, $viewable, $create=false)
provideHasViewableContent WikiPage::hasViewableContent
Special handling for category pages.
testExists()
WikiPage::exists.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached $page
static destroySingletons()
Destroy the singleton instances.
Allows to change the fields on the form that will be generated $name
createPage($page, $text, $model=null)