9use InvalidArgumentException;
25use PHPUnit_Framework_MockObject_MockObject;
74 $this->tablesUsed[] =
'archive';
75 $this->tablesUsed[] =
'page';
76 $this->tablesUsed[] =
'revision';
77 $this->tablesUsed[] =
'comment';
98 if ( $this->testPageTitle ) {
102 $this->testPageTitle = Title::newFromText(
'UTPage-' . __CLASS__ );
110 if ( $this->testPage ) {
115 $this->testPage = WikiPage::factory(
$title );
117 if ( !$this->testPage->exists() ) {
121 $user = static::getTestSysop()->getUser();
123 $this->testPage->doEditContent(
125 'UTPageSummary-' . __CLASS__,
139 $domain =
new DatabaseDomain( $server[
'dbname'],
null, $server[
'tablePrefix'] );
141 $lb = $this->getMockBuilder( LoadBalancer::class )
142 ->setMethods( [
'reallyOpenConnection' ] )
143 ->setConstructorArgs( [
144 [
'servers' => [ $server ],
'localDomain' => $domain ]
148 $lb->method(
'reallyOpenConnection' )->willReturnCallback(
149 function (
array $server, $dbNameOverride ) {
161 $db = $this->getMockBuilder( DatabaseSqlite::class )
162 ->setMethods( [
'select',
'doQuery',
'open',
'closeConnection',
'isOpen' ] )
163 ->setConstructorArgs( [
$params ] )
167 $db->method(
'isOpen' )->willReturn(
true );
173 yield [
false,
'test',
'' ];
174 yield [
'test',
'test',
'' ];
176 yield [
false,
'test',
'foo_' ];
177 yield [
'test-foo_',
'test',
'foo_' ];
179 yield [
false,
'dash-test',
'' ];
180 yield [
'dash-test',
'dash-test',
'' ];
182 yield [
false,
'underscore_test',
'foo_' ];
183 yield [
'underscore_test-foo_',
'underscore_test',
'foo_' ];
193 'wgDBname' => $dbName,
194 'wgDBprefix' => $dbPrefix,
201 'dbDirectory' =>
'*dummy*',
203 'password' =>
'test',
212 'connLogger' =>
new \Psr\Log\NullLogger(),
213 'queryLogger' =>
new \Psr\Log\NullLogger(),
214 'errorLogger' =>
function () {
216 'deprecationLogger' =>
function () {
220 'tablePrefix' => $dbPrefix,
226 $blobStore = $this->getMockBuilder( SqlBlobStore::class )
227 ->disableOriginalConstructor()
243 $count = $store->countRevisionsByPageId(
$db, 0 );
247 $this->assertSame( 0, $count );
272 $this->assertEquals( $r1->
getUser()->getName(), $r2->
getUser()->getName() );
273 $this->assertEquals( $r1->
getUser()->getId(), $r2->
getUser()->getId() );
288 RevisionRecord::DELETED_TEXT,
289 RevisionRecord::DELETED_COMMENT,
290 RevisionRecord::DELETED_USER,
291 RevisionRecord::DELETED_RESTRICTED,
310 $this->assertTrue( $r->
hasSlot( SlotRecord::MAIN ) );
311 $this->assertInstanceOf( SlotRecord::class, $r->
getSlot( SlotRecord::MAIN ) );
312 $this->assertInstanceOf( Content::class, $r->
getContent( SlotRecord::MAIN ) );
323 $this->assertInstanceOf( Content::class, $slot->
getContent() );
333 if ( isset( $details[
'user'] ) && $details[
'user'] ===
true ) {
334 $details[
'user'] = $this->
getTestUser()->getUser();
336 if ( isset( $details[
'page'] ) && $details[
'page'] ===
true ) {
339 if ( isset( $details[
'parent'] ) && $details[
'parent'] ===
true ) {
340 $details[
'parent'] = $this->
getTestPage()->getLatest();
345 isset( $details[
'slot'] ) ?
$rev->setSlot( $details[
'slot'] ) :
null;
346 isset( $details[
'parent'] ) ?
$rev->setParentId( $details[
'parent'] ) :
null;
347 isset( $details[
'page'] ) ?
$rev->setPageId( $details[
'page'] ) :
null;
348 isset( $details[
'size'] ) ?
$rev->setSize( $details[
'size'] ) :
null;
349 isset( $details[
'sha1'] ) ?
$rev->setSha1( $details[
'sha1'] ) :
null;
350 isset( $details[
'comment'] ) ?
$rev->setComment( $details[
'comment'] ) :
null;
351 isset( $details[
'timestamp'] ) ?
$rev->setTimestamp( $details[
'timestamp'] ) :
null;
352 isset( $details[
'minor'] ) ?
$rev->setMinorEdit( $details[
'minor'] ) :
null;
353 isset( $details[
'user'] ) ?
$rev->setUser( $details[
'user'] ) :
null;
354 isset( $details[
'visibility'] ) ?
$rev->setVisibility( $details[
'visibility'] ) :
null;
355 isset( $details[
'id'] ) ?
$rev->setId( $details[
'id'] ) :
null;
357 if ( isset( $details[
'content'] ) ) {
358 foreach ( $details[
'content']
as $role =>
$content ) {
367 yield
'Bare minimum revision insertion' => [
369 'slot' => SlotRecord::newUnsaved( SlotRecord::MAIN,
new WikitextContent(
'Chicken' ) ),
372 'timestamp' =>
'20171117010101',
376 yield
'Detailed revision insertion' => [
378 'slot' => SlotRecord::newUnsaved( SlotRecord::MAIN,
new WikitextContent(
'Chicken' ) ),
382 'timestamp' =>
'20171117010101',
385 'visibility' => RevisionRecord::DELETED_RESTRICTED,
391 return CommentStoreComment::newUnsavedComment( __METHOD__ .
'.' . rand( 0, 1000 ) );
401 array $revDetails = []
416 $loaded = $store->getRevisionById( $return->getId() );
428 unset( $row->rev_content_model );
429 unset( $row->rev_content_format );
432 unset( $row->rev_comment_text );
433 unset( $row->rev_comment_data );
434 unset( $row->rev_comment_cid );
435 unset( $row->rev_comment_id );
438 $queryInfo = $store->getQueryInfo( [
'user' ] );
440 $row = get_object_vars( $row );
443 $keys = array_keys( $row );
445 $fields = array_intersect_key( $queryInfo[
'fields'],
$keys ) +
$keys;
452 $queryInfo[
'tables'],
454 [
'rev_id' =>
$rev->getId() ],
455 [ array_values( $row ) ],
476 'slot' => SlotRecord::newUnsaved( SlotRecord::MAIN,
new WikitextContent(
'Chicken' ) ),
479 'timestamp' =>
'20171117010101',
493 $revDetails[
'slot'] = SlotRecord::newInherited( $firstReturn->getSlot( SlotRecord::MAIN ) );
499 $firstMainSlot = $firstReturn->getSlot( SlotRecord::MAIN );
500 $secondMainSlot = $secondReturn->getSlot( SlotRecord::MAIN );
505 $this->assertNotSame( $firstReturn->getId(), $secondReturn->getId() );
508 $this->assertSame( $firstReturn->getId(), $firstMainSlot->getRevision() );
509 $this->assertSame( $secondReturn->getId(), $secondMainSlot->getRevision() );
516 'timestamp' =>
'20171117010101',
519 new InvalidArgumentException(
'main slot must be provided' )
521 yield
'no main slot' => [
523 'slot' => SlotRecord::newUnsaved(
'aux',
new WikitextContent(
'Turkey' ) ),
525 'timestamp' =>
'20171117010101',
528 new InvalidArgumentException(
'main slot must be provided' )
530 yield
'no timestamp' => [
532 'slot' => SlotRecord::newUnsaved( SlotRecord::MAIN,
new WikitextContent(
'Chicken' ) ),
538 yield
'no comment' => [
540 'slot' => SlotRecord::newUnsaved( SlotRecord::MAIN,
new WikitextContent(
'Chicken' ) ),
541 'timestamp' =>
'20171117010101',
548 'slot' => SlotRecord::newUnsaved( SlotRecord::MAIN,
new WikitextContent(
'Chicken' ) ),
550 'timestamp' =>
'20171117010101',
561 array $revDetails = [],
568 $this->setExpectedException(
569 get_class( $exception ),
570 $exception->getMessage(),
571 $exception->getCode()
578 Title::newFromText(
'UTPage_notAutoCreated' ),
580 CommentStoreComment::newUnsavedComment( __METHOD__ .
' comment1' ),
584 Title::newFromText(
'UTPage_notAutoCreated' ),
586 CommentStoreComment::newUnsavedComment( __METHOD__ .
' comment2', [
'a' => 1 ] ),
600 $page = WikiPage::factory(
$title );
602 if ( !$page->exists() ) {
606 $revDetails[
'page'] = $page->getId();
608 $revDetails[
'comment'] = CommentStoreComment::newUnsavedComment(
'Base' );
609 $revDetails[
'user'] =
$user;
615 $baseRev = $store->insertRevisionOn( $baseRev, $dbw );
616 $page->updateRevisionOn( $dbw,
new Revision( $baseRev ), $page->getLatest() );
618 $record = $store->newNullRevision(
626 $this->assertEquals(
$title->getNamespace(), $record->getPageAsLinkTarget()->getNamespace() );
627 $this->assertEquals(
$title->getDBkey(), $record->getPageAsLinkTarget()->getDBkey() );
628 $this->assertEquals( $comment, $record->getComment() );
629 $this->assertEquals( $minor, $record->isMinor() );
630 $this->assertEquals(
$user->getName(), $record->getUser()->getName() );
631 $this->assertEquals( $baseRev->getId(), $record->getParentId() );
634 $baseRev->getSlotRoles(),
635 $record->getSlotRoles()
638 foreach ( $baseRev->getSlotRoles()
as $role ) {
639 $parentSlot = $baseRev->getSlot( $role );
640 $slot = $record->getSlot( $role );
642 $this->assertTrue( $slot->isInherited(),
'isInherited' );
643 $this->assertSame( $parentSlot->getOrigin(), $slot->getOrigin(),
'getOrigin' );
653 $record = $store->newNullRevision(
655 Title::newFromText( __METHOD__ .
'.iDontExist!' ),
656 CommentStoreComment::newUnsavedComment( __METHOD__ .
' comment' ),
660 $this->assertNull( $record );
673 $revisionRecord = $store->getRevisionById(
$rev->getId() );
674 $result = $store->getRcIdIfUnpatrolled( $revisionRecord );
676 $this->assertGreaterThan( 0,
$result );
678 $store->getRecentChange( $revisionRecord )->getAttribute(
'rc_id' ),
690 $status = $page->doEditContent(
701 $revisionRecord = $store->getRevisionById(
$rev->getId() );
702 $result = $store->getRcIdIfUnpatrolled( $revisionRecord );
704 $this->assertSame( 0,
$result );
718 $revRecord = $store->getRevisionById(
$rev->getId() );
719 $recentChange = $store->getRecentChange( $revRecord );
721 $this->assertEquals(
$rev->getId(), $recentChange->getAttribute(
'rc_this_oldid' ) );
722 $this->assertEquals(
$rev->getRecentChange(), $recentChange );
736 $revRecord = $store->getRevisionById(
$rev->getId() );
738 $this->assertSame(
$rev->getId(), $revRecord->getId() );
739 $this->assertTrue( $revRecord->getSlot( SlotRecord::MAIN )->getContent()->equals(
$content ) );
740 $this->assertSame( __METHOD__, $revRecord->getComment()->text );
754 $revRecord = $store->getRevisionByTitle( $page->getTitle() );
756 $this->assertSame(
$rev->getId(), $revRecord->getId() );
757 $this->assertTrue( $revRecord->getSlot( SlotRecord::MAIN )->getContent()->equals(
$content ) );
758 $this->assertSame( __METHOD__, $revRecord->getComment()->text );
772 $revRecord = $store->getRevisionByPageId( $page->getId() );
774 $this->assertSame(
$rev->getId(), $revRecord->getId() );
775 $this->assertTrue( $revRecord->getSlot( SlotRecord::MAIN )->getContent()->equals(
$content ) );
776 $this->assertSame( __METHOD__, $revRecord->getComment()->text );
794 $revRecord = $store->getRevisionByTimestamp(
799 $this->assertSame(
$rev->getId(), $revRecord->getId() );
800 $this->assertTrue( $revRecord->getSlot( SlotRecord::MAIN )->getContent()->equals(
$content ) );
801 $this->assertSame( __METHOD__, $revRecord->getComment()->text );
806 $page = WikiPage::factory(
$rev->getTitle() );
811 'rev_timestamp' => $this->db->timestamp(
$rev->getTimestamp() ),
812 'rev_user_text' => (
string)
$rev->getUserText(),
813 'rev_user' => (
string)
$rev->getUser() ?:
null,
814 'rev_minor_edit' =>
$rev->isMinor() ?
'1' :
'0',
815 'rev_deleted' => (
string)
$rev->getVisibility(),
817 'rev_parent_id' => (
string)
$rev->getParentId(),
821 if ( in_array(
'page',
$options ) ) {
823 'page_namespace' => (
string)$page->getTitle()->getNamespace(),
824 'page_title' => $page->getTitle()->getDBkey(),
825 'page_id' => (
string)$page->getId(),
826 'page_latest' => (
string)$page->getLatest(),
827 'page_is_redirect' => $page->isRedirect() ?
'1' :
'0',
828 'page_len' => (
string)$page->getContent()->getSize(),
832 if ( in_array(
'user',
$options ) ) {
838 if ( in_array(
'comment',
$options ) ) {
840 'rev_comment_text' =>
$rev->getComment(),
841 'rev_comment_data' =>
null,
842 'rev_comment_cid' =>
null,
846 if (
$rev->getId() ) {
852 return (
object)$fields;
859 $this->assertSame(
$rev->getId(), $record->
getId() );
862 $this->assertSame(
$rev->getUserText(), $record->
getUser()->getName() );
863 $this->assertSame(
$rev->getUser(), $record->
getUser()->getId() );
864 $this->assertSame(
$rev->isMinor(), $record->
isMinor() );
866 $this->assertSame(
$rev->getSize(), $record->
getSize() );
871 $expectedParent =
$rev->getParentId();
872 if ( $expectedParent ===
null ) {
875 $this->assertSame( $expectedParent, $record->
getParentId() );
876 $this->assertSame(
$rev->getSha1(), $record->
getSha1() );
877 $this->assertSame(
$rev->getComment(), $record->
getComment()->text );
878 $this->assertSame(
$rev->getContentFormat(),
879 $record->
getContent( SlotRecord::MAIN )->getDefaultFormat() );
880 $this->assertSame(
$rev->getContentModel(), $record->
getContent( SlotRecord::MAIN )->getModel() );
883 $revRec =
$rev->getRevisionRecord();
884 $revMain = $revRec->getSlot( SlotRecord::MAIN );
885 $recMain = $record->
getSlot( SlotRecord::MAIN );
887 $this->assertSame( $revMain->hasOrigin(), $recMain->hasOrigin(),
'hasOrigin' );
888 $this->assertSame( $revMain->hasAddress(), $recMain->hasAddress(),
'hasAddress' );
889 $this->assertSame( $revMain->hasContentId(), $recMain->hasContentId(),
'hasContentId' );
891 if ( $revMain->hasOrigin() ) {
892 $this->assertSame( $revMain->getOrigin(), $recMain->getOrigin(),
'getOrigin' );
895 if ( $revMain->hasAddress() ) {
896 $this->assertSame( $revMain->getAddress(), $recMain->getAddress(),
'getAddress' );
899 if ( $revMain->hasContentId() ) {
900 $this->assertSame( $revMain->getContentId(), $recMain->getContentId(),
'getContentId' );
910 $text = __METHOD__ .
'a-ä';
912 $rev = $page->doEditContent(
915 )->value[
'revision'];
918 $info = $store->getQueryInfo();
919 $row = $this->db->selectRow(
922 [
'rev_id' =>
$rev->getId() ],
927 $record = $store->newRevisionFromRow(
933 $this->assertSame( $text,
$rev->getContent()->serialize() );
941 $text = __METHOD__ .
'a-ä';
943 $rev = $page->doEditContent(
946 )->value[
'revision'];
949 $record = $store->newRevisionFromRow(
955 $this->assertSame( $text,
$rev->getContent()->serialize() );
962 $this->
setMwGlobals(
'wgLegacyEncoding',
'windows-1252' );
965 $text = __METHOD__ .
'a-ä';
967 $rev = $page->doEditContent(
970 )->value[
'revision'];
973 $record = $store->newRevisionFromRow(
979 $this->assertSame( $text,
$rev->getContent()->serialize() );
987 $text = __METHOD__ .
'b-ä';
989 $rev = $page->doEditContent(
995 )->value[
'revision'];
998 $record = $store->newRevisionFromRow(
1004 $this->assertSame( $text,
$rev->getContent()->serialize() );
1013 $title = Title::newFromText( __METHOD__ );
1014 $text = __METHOD__ .
'-bä';
1015 $page = WikiPage::factory(
$title );
1017 $orig = $page->doEditContent(
new WikitextContent( $text ), __METHOD__ )
1018 ->value[
'revision'];
1019 $page->doDeleteArticle( __METHOD__ );
1022 $arQuery = $store->getArchiveQueryInfo();
1024 $arQuery[
'tables'], $arQuery[
'fields'], [
'ar_rev_id' => $orig->getId() ],
1025 __METHOD__, [], $arQuery[
'joins']
1027 $this->assertTrue( is_object(
$res ),
'query failed' );
1029 $row =
$res->fetchObject();
1031 $record = $store->newRevisionFromArchiveRow( $row );
1034 $this->assertSame( $text, $record->getContent( SlotRecord::MAIN )->serialize() );
1041 $this->
setMwGlobals(
'wgLegacyEncoding',
'windows-1252' );
1044 $title = Title::newFromText( __METHOD__ );
1045 $text = __METHOD__ .
'-bä';
1046 $page = WikiPage::factory(
$title );
1048 $orig = $page->doEditContent(
new WikitextContent( $text ), __METHOD__ )
1049 ->value[
'revision'];
1050 $page->doDeleteArticle( __METHOD__ );
1053 $arQuery = $store->getArchiveQueryInfo();
1055 $arQuery[
'tables'], $arQuery[
'fields'], [
'ar_rev_id' => $orig->getId() ],
1056 __METHOD__, [], $arQuery[
'joins']
1058 $this->assertTrue( is_object(
$res ),
'query failed' );
1060 $row =
$res->fetchObject();
1062 $record = $store->newRevisionFromArchiveRow( $row );
1065 $this->assertSame( $text, $record->getContent( SlotRecord::MAIN )->serialize() );
1076 'ar_page_id' =>
'2',
1077 'ar_namespace' =>
'0',
1078 'ar_title' =>
'Something',
1080 'ar_text_id' =>
'47',
1081 'ar_timestamp' =>
'20180528192356',
1082 'ar_minor_edit' =>
'0',
1083 'ar_deleted' =>
'0',
1085 'ar_parent_id' =>
'0',
1086 'ar_sha1' =>
'deadbeef',
1087 'ar_comment_text' =>
'whatever',
1088 'ar_comment_data' =>
null,
1089 'ar_comment_cid' =>
null,
1091 'ar_user_text' =>
'',
1093 'ar_content_format' =>
null,
1094 'ar_content_model' =>
null,
1097 \Wikimedia\suppressWarnings();
1098 $record = $store->newRevisionFromArchiveRow( $row );
1099 \Wikimedia\suppressWarnings(
true );
1101 $this->assertInstanceOf( RevisionRecord::class, $record );
1102 $this->assertInstanceOf( UserIdentityValue::class, $record->getUser() );
1103 $this->assertSame(
'Unknown user', $record->getUser()->getName() );
1111 $title = Title::newFromText( __METHOD__ );
1116 'page_namespace' =>
'0',
1117 'page_title' =>
$title->getText(),
1118 'rev_text_id' =>
'47',
1119 'rev_timestamp' =>
'20180528192356',
1120 'rev_minor_edit' =>
'0',
1121 'rev_deleted' =>
'0',
1123 'rev_parent_id' =>
'0',
1124 'rev_sha1' =>
'deadbeef',
1125 'rev_comment_text' =>
'whatever',
1126 'rev_comment_data' =>
null,
1127 'rev_comment_cid' =>
null,
1129 'rev_user_text' =>
'',
1130 'rev_actor' =>
null,
1131 'rev_content_format' =>
null,
1132 'rev_content_model' =>
null,
1135 \Wikimedia\suppressWarnings();
1136 $record = $store->newRevisionFromRow( $row, 0,
$title );
1137 \Wikimedia\suppressWarnings(
true );
1139 $this->assertNotNull( $record );
1140 $this->assertNotNull( $record->getUser() );
1141 $this->assertNotEmpty( $record->getUser()->getName() );
1152 $title = Title::newFromText( __METHOD__ );
1154 $page = WikiPage::factory(
$title );
1156 $page->doEditContent(
new WikitextContent(
"First" ), __METHOD__ .
'-first' );
1157 $origRev = $page->doEditContent(
new WikitextContent(
"Foo" ), __METHOD__ )
1158 ->value[
'revision'];
1159 $orig = $origRev->getRevisionRecord();
1160 $page->doDeleteArticle( __METHOD__ );
1166 $arQuery = $store->getArchiveQueryInfo();
1168 $arQuery[
'tables'], $arQuery[
'fields'], [
'ar_rev_id' => $orig->getId() ],
1169 __METHOD__, [], $arQuery[
'joins']
1172 $this->assertNotFalse( $row,
'query failed' );
1174 $record = $store->newRevisionFromArchiveRow(
1178 [
'page_id' =>
$title->getArticleID() ]
1181 $restored = $store->insertRevisionOn( $record,
$db );
1188 $recMain = $record->getSlot( SlotRecord::MAIN );
1189 $restMain = $restored->getSlot( SlotRecord::MAIN );
1190 $this->assertSame( $recMain->getAddress(), $restMain->getAddress() );
1191 $this->assertSame( $recMain->getContentId(), $restMain->getContentId() );
1192 $this->assertSame( $recMain->getOrigin(), $restMain->getOrigin() );
1193 $this->assertSame(
'Foo', $restMain->getContent()->serialize() );
1196 $loaded = $store->getRevisionById( $restored->getId() );
1197 $this->assertNotNull( $loaded );
1209 $title = Title::newFromText( __METHOD__ );
1210 $page = WikiPage::factory(
$title );
1213 ->value[
'revision'];
1224 $title = Title::newFromText( __METHOD__ );
1225 $page = WikiPage::factory(
$title );
1228 ->value[
'revision'];
1239 $title = Title::newFromText( __METHOD__ );
1240 $page = WikiPage::factory(
$title );
1243 ->value[
'revision'];
1254 $title = Title::newFromText( __METHOD__ );
1255 $page = WikiPage::factory(
$title );
1257 $revOne = $page->doEditContent(
new WikitextContent( __METHOD__ ), __METHOD__ )
1258 ->value[
'revision'];
1262 $revTwo = $page->doEditContent(
new WikitextContent( __METHOD__ .
'a' ),
'' )
1263 ->value[
'revision'];
1271 $store->loadRevisionFromTimestamp(
1274 $revOne->getTimestamp()
1279 $store->loadRevisionFromTimestamp(
1282 $revTwo->getTimestamp()
1291 $page = WikiPage::factory( Title::newFromText( __METHOD__ ) );
1293 $revOne = $page->doEditContent(
1295 )->value[
'revision'];
1297 $revTwo = $page->doEditContent(
1299 )->value[
'revision'];
1304 $revOne->getId() => strlen( __METHOD__ ),
1306 $store->listRevisionSizes(
1308 [ $revOne->getId() ]
1313 $revOne->getId() => strlen( __METHOD__ ),
1314 $revTwo->getId() => strlen( __METHOD__ ) + 1,
1316 $store->listRevisionSizes(
1318 [ $revOne->getId(), $revTwo->getId() ]
1327 $page = WikiPage::factory( Title::newFromText( __METHOD__ ) );
1329 $revOne = $page->doEditContent(
1331 )->value[
'revision'];
1333 $revTwo = $page->doEditContent(
1335 )->value[
'revision'];
1339 $store->getPreviousRevision( $store->getRevisionById( $revOne->getId() ) )
1343 $store->getPreviousRevision( $store->getRevisionById( $revTwo->getId() ) )->getId()
1351 $page = WikiPage::factory( Title::newFromText( __METHOD__ ) );
1353 $revOne = $page->doEditContent(
1355 )->value[
'revision'];
1357 $revTwo = $page->doEditContent(
1359 )->value[
'revision'];
1364 $store->getNextRevision( $store->getRevisionById( $revOne->getId() ) )->getId()
1367 $store->getNextRevision( $store->getRevisionById( $revTwo->getId() ) )
1372 $title = Title::newFromText( __METHOD__ );
1377 $comment = CommentStoreComment::newUnsavedComment(
'Test' );
1380 'ar_rev_id' => 34567,
1383 'ar_minor_edit' => 0,
1384 'ar_timestamp' =>
'20180101020202',
1397 $this->assertNull( $store->getPreviousRevision(
$rev ) );
1406 $this->assertNull( $store->getNextRevision(
$rev ) );
1416 ->value[
'revision'];
1419 $result = $store->getTimestampFromId(
1424 $this->assertSame(
$rev->getTimestamp(),
$result );
1434 ->value[
'revision'];
1437 $result = $store->getTimestampFromId(
1442 $this->assertFalse(
$result );
1450 $page = WikiPage::factory( Title::newFromText( __METHOD__ ) );
1473 $page = WikiPage::factory( Title::newFromText( __METHOD__ ) );
1497 $page->doEditContent(
new WikitextContent( __METHOD__ ), __METHOD__ );
1500 $result = $store->userWasLastToEdit(
1506 $this->assertFalse(
$result );
1516 $page->doEditContent(
1525 $result = $store->userWasLastToEdit(
1540 $rev = $page->doEditContent(
1546 )->value[
'revision'];
1549 $record = $store->getKnownCurrentRevision(
1558 yield
'Basic array, content object' => [
1562 'timestamp' =>
'20171017114835',
1563 'user_text' =>
'111.0.1.2',
1565 'minor_edit' =>
false,
1569 'sha1' =>
'rdqbbzs3pkhihgbs8qf2q9jsvheag5z',
1570 'comment' =>
'Goat Comment!',
1574 yield
'Basic array, serialized text' => [
1578 'timestamp' =>
'20171017114835',
1579 'user_text' =>
'111.0.1.2',
1581 'minor_edit' =>
false,
1585 'sha1' =>
'rdqbbzs3pkhihgbs8qf2q9jsvheag5z',
1586 'comment' =>
'Goat Comment!',
1590 yield
'Basic array, serialized text, utf-8 flags' => [
1594 'timestamp' =>
'20171017114835',
1595 'user_text' =>
'111.0.1.2',
1597 'minor_edit' =>
false,
1601 'sha1' =>
'rdqbbzs3pkhihgbs8qf2q9jsvheag5z',
1602 'comment' =>
'Goat Comment!',
1607 yield
'Basic array, with title' => [
1609 'title' => Title::newFromText(
'SomeText' ),
1610 'timestamp' =>
'20171017114835',
1611 'user_text' =>
'111.0.1.2',
1613 'minor_edit' =>
false,
1617 'sha1' =>
'rdqbbzs3pkhihgbs8qf2q9jsvheag5z',
1618 'comment' =>
'Goat Comment!',
1622 yield
'Basic array, no user field' => [
1626 'timestamp' =>
'20171017114835',
1627 'user_text' =>
'111.0.1.3',
1628 'minor_edit' =>
false,
1632 'sha1' =>
'rdqbbzs3pkhihgbs8qf2q9jsvheag5z',
1633 'comment' =>
'Goat Comment!',
1647 if ( isset( $array[
'page'] ) ) {
1648 $t = Title::newFromID( $array[
'page'] );
1649 if ( !
$t || !
$t->exists() ) {
1650 $t = Title::makeTitle(
NS_MAIN, __METHOD__ );
1652 $array[
'page'] = $info[
'id'];
1656 $result = $store->newMutableRevisionFromArray( $array );
1658 if ( isset( $array[
'id'] ) ) {
1659 $this->assertSame( $array[
'id'],
$result->getId() );
1661 if ( isset( $array[
'page'] ) ) {
1662 $this->assertSame( $array[
'page'],
$result->getPageId() );
1664 $this->assertSame( $array[
'timestamp'],
$result->getTimestamp() );
1665 $this->assertSame( $array[
'user_text'],
$result->getUser()->getName() );
1666 if ( isset( $array[
'user'] ) ) {
1667 $this->assertSame( $array[
'user'],
$result->getUser()->getId() );
1669 $this->assertSame( (
bool)$array[
'minor_edit'],
$result->isMinor() );
1670 $this->assertSame( $array[
'deleted'],
$result->getVisibility() );
1671 $this->assertSame( $array[
'len'],
$result->getSize() );
1672 $this->assertSame( $array[
'parent_id'],
$result->getParentId() );
1673 $this->assertSame( $array[
'sha1'],
$result->getSha1() );
1674 $this->assertSame( $array[
'comment'],
$result->getComment()->text );
1675 if ( isset( $array[
'content'] ) ) {
1676 foreach ( $array[
'content']
as $role =>
$content ) {
1681 } elseif ( isset( $array[
'text'] ) ) {
1682 $this->assertSame( $array[
'text'],
1683 $result->getSlot( SlotRecord::MAIN )->getContent()->serialize() );
1684 } elseif ( isset( $array[
'content_format'] ) ) {
1686 $array[
'content_format'],
1687 $result->getSlot( SlotRecord::MAIN )->getContent()->getDefaultFormat()
1689 $this->assertSame( $array[
'content_model'],
$result->getSlot( SlotRecord::MAIN )->getModel() );
1701 $blobStore->setLegacyEncoding(
'windows-1252', Language::factory(
'en' ) );
1703 $factory = $this->getMockBuilder( BlobStoreFactory::class )
1704 ->setMethods( [
'newBlobStore',
'newSqlBlobStore' ] )
1705 ->disableOriginalConstructor()
1707 $factory->expects( $this->any() )
1708 ->method(
'newBlobStore' )
1709 ->willReturn( $blobStore );
1710 $factory->expects( $this->any() )
1711 ->method(
'newSqlBlobStore' )
1712 ->willReturn( $blobStore );
1714 $this->
setService(
'BlobStoreFactory', $factory );
1730 $summary = CommentStoreComment::newUnsavedComment( __METHOD__ );
1732 return $store->getKnownCurrentRevision( $page->getTitle(),
$rev->getId() );
1750 $userNameBefore =
$rev->getUser()->getName();
1753 $newUserName =
"Renamed $userNameBefore";
1754 $this->db->update(
'revision',
1755 [
'rev_user_text' => $newUserName ],
1756 [
'rev_id' =>
$rev->getId() ] );
1757 $this->db->update(
'user',
1758 [
'user_name' => $newUserName ],
1759 [
'user_id' =>
$rev->getUser()->getId() ] );
1761 $this->db->update(
'actor',
1762 [
'actor_name' => $newUserName ],
1763 [
'actor_user' =>
$rev->getUser()->getId() ] );
1767 $revAfter = $store->getKnownCurrentRevision( $page->getTitle(),
$rev->getId() );
1768 $userNameAfter = $revAfter->getUser()->getName();
1772 $this->assertNotSame( $userNameBefore, $userNameAfter );
1775 $this->assertSame( $newUserName, $userNameAfter );
1791 $deletedBefore =
$rev->getVisibility();
1794 $this->db->update(
'revision',
1795 [
'rev_deleted' => RevisionRecord::DELETED_TEXT ],
1796 [
'rev_id' =>
$rev->getId() ] );
1799 $revAfter = $store->getKnownCurrentRevision( $page->getTitle(),
$rev->getId() );
1800 $deletedAfter = $revAfter->getVisibility();
1804 $this->assertNotSame( $deletedBefore, $deletedAfter );
1807 $this->assertSame( RevisionRecord::DELETED_TEXT, $deletedAfter );
1819 $rev = $page->doEditContent(
1825 )->value[
'revision'];
1828 $record = $store->newRevisionFromRow(
1835 $userNameBefore = $record->getUser()->getName();
1838 $newUserName =
"Renamed $userNameBefore";
1839 $this->db->update(
'revision',
1840 [
'rev_user_text' => $newUserName ],
1841 [
'rev_id' => $record->getId() ] );
1842 $this->db->update(
'user',
1843 [
'user_name' => $newUserName ],
1844 [
'user_id' => $record->getUser()->getId() ] );
1846 $this->db->update(
'actor',
1847 [
'actor_name' => $newUserName ],
1848 [
'actor_user' => $record->getUser()->getId() ] );
1853 $recordAfter = $store->newRevisionFromRow(
1859 $userNameAfter = $recordAfter->getUser()->getName();
1863 $this->assertNotSame( $userNameBefore, $userNameAfter );
1866 $this->assertSame( $newUserName, $userNameAfter );
1876 $rev = $page->doEditContent(
1879 )->value[
'revision'];
1882 $record = $store->newRevisionFromRow(
1889 $deletedBefore = $record->getVisibility();
1892 $this->db->update(
'revision',
1893 [
'rev_deleted' => RevisionRecord::DELETED_TEXT ],
1894 [
'rev_id' => $record->getId() ] );
1898 $recordAfter = $store->newRevisionFromRow(
1904 $deletedAfter = $recordAfter->getVisibility();
1907 $this->assertNotSame( $deletedBefore, $deletedAfter );
1910 $this->assertSame( RevisionRecord::DELETED_TEXT, $deletedAfter );
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
int $wgActorTableSchemaMigrationStage
Actor table schema migration stage.
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Simple store for keeping values in an associative array for the current process.
Internationalisation code.
getTitle()
Returns the title of the page associated with this entry.
static getMutableTestUser( $testName, $groups=[])
Get a TestUser object that the caller may modify.
Represents a title within MediaWiki.
Multi-datacenter aware caching interface.
Class representing a MediaWiki article and history.
Class to handle database/prefix specification for IDatabase domains.
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
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
const SCHEMA_COMPAT_WRITE_NEW
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
This code would result in ircNotify being run twice when an article is and once for brion Hooks can return three possible true was required This is the default since MediaWiki *some string
Status::newGood()` to allow deletion, and then `return false` from the hook function. Ensure you consume the 'ChangeTagAfterDelete' hook to carry out custom deletion actions. $tag:name of the tag $user:user initiating the action & $status:Status object. See above. 'ChangeTagsListActive':Allows you to nominate which of the tags your extension uses are in active use. & $tags:list of all active tags. Append to this array. 'ChangeTagsAfterUpdateTags':Called after tags have been updated with the ChangeTags::updateTags function. Params:$addedTags:tags effectively added in the update $removedTags:tags effectively removed in the update $prevTags:tags that were present prior to the update $rc_id:recentchanges table id $rev_id:revision table id $log_id:logging table id $params:tag params $rc:RecentChange being tagged when the tagging accompanies the action, or null $user:User who performed the tagging when the tagging is subsequent to the action, or null 'ChangeTagsAllowedAdd':Called when checking if a user can add tags to a change. & $allowedTags:List of all the tags the user is allowed to add. Any tags the user wants to add( $addTags) that are not in this array will cause it to fail. You may add or remove tags to this array as required. $addTags:List of tags user intends to add. $user:User who is adding the tags. 'ChangeUserGroups':Called before user groups are changed. $performer:The User who will perform the change $user:The User whose groups will be changed & $add:The groups that will be added & $remove:The groups that will be removed 'Collation::factory':Called if $wgCategoryCollation is an unknown collation. $collationName:Name of the collation in question & $collationObject:Null. Replace with a subclass of the Collation class that implements the collation given in $collationName. 'ConfirmEmailComplete':Called after a user 's email has been confirmed successfully. $user:user(object) whose email is being confirmed 'ContentAlterParserOutput':Modify parser output for a given content object. Called by Content::getParserOutput after parsing has finished. Can be used for changes that depend on the result of the parsing but have to be done before LinksUpdate is called(such as adding tracking categories based on the rendered HTML). $content:The Content to render $title:Title of the page, as context $parserOutput:ParserOutput to manipulate 'ContentGetParserOutput':Customize parser output for a given content object, called by AbstractContent::getParserOutput. May be used to override the normal model-specific rendering of page content. $content:The Content to render $title:Title of the page, as context $revId:The revision ID, as context $options:ParserOptions for rendering. To avoid confusing the parser cache, the output can only depend on parameters provided to this hook function, not on global state. $generateHtml:boolean, indicating whether full HTML should be generated. If false, generation of HTML may be skipped, but other information should still be present in the ParserOutput object. & $output:ParserOutput, to manipulate or replace 'ContentHandlerDefaultModelFor':Called when the default content model is determined for a given title. May be used to assign a different model for that title. $title:the Title in question & $model:the model name. Use with CONTENT_MODEL_XXX constants. 'ContentHandlerForModelID':Called when a ContentHandler is requested for a given content model name, but no entry for that model exists in $wgContentHandlers. Note:if your extension implements additional models via this hook, please use GetContentModels hook to make them known to core. $modeName:the requested content model name & $handler:set this to a ContentHandler object, if desired. 'ContentModelCanBeUsedOn':Called to determine whether that content model can be used on a given page. This is especially useful to prevent some content models to be used in some special location. $contentModel:ID of the content model in question $title:the Title in question. & $ok:Output parameter, whether it is OK to use $contentModel on $title. Handler functions that modify $ok should generally return false to prevent further hooks from further modifying $ok. 'ContribsPager::getQueryInfo':Before the contributions query is about to run & $pager:Pager object for contributions & $queryInfo:The query for the contribs Pager 'ContribsPager::reallyDoQuery':Called before really executing the query for My Contributions & $data:an array of results of all contribs queries $pager:The ContribsPager object hooked into $offset:Index offset, inclusive $limit:Exact query limit $descending:Query direction, false for ascending, true for descending 'ContributionsLineEnding':Called before a contributions HTML line is finished $page:SpecialPage object for contributions & $ret:the HTML line $row:the DB row for this line & $classes:the classes to add to the surrounding< li > & $attribs:associative array of other HTML attributes for the< li > element. Currently only data attributes reserved to MediaWiki are allowed(see Sanitizer::isReservedDataAttribute). 'ContributionsToolLinks':Change tool links above Special:Contributions $id:User identifier $title:User page title & $tools:Array of tool links $specialPage:SpecialPage instance for context and services. Can be either SpecialContributions or DeletedContributionsPage. Extensions should type hint against a generic SpecialPage though. 'ConvertContent':Called by AbstractContent::convert when a conversion to another content model is requested. Handler functions that modify $result should generally return false to disable further attempts at conversion. $content:The Content object to be converted. $toModel:The ID of the content model to convert to. $lossy:boolean indicating whether lossy conversion is allowed. & $result:Output parameter, in case the handler function wants to provide a converted Content object. Note that $result->getContentModel() must return $toModel. 'ContentSecurityPolicyDefaultSource':Modify the allowed CSP load sources. This affects all directives except for the script directive. If you want to add a script source, see ContentSecurityPolicyScriptSource hook. & $defaultSrc:Array of Content-Security-Policy allowed sources $policyConfig:Current configuration for the Content-Security-Policy header $mode:ContentSecurityPolicy::REPORT_ONLY_MODE or ContentSecurityPolicy::FULL_MODE depending on type of header 'ContentSecurityPolicyDirectives':Modify the content security policy directives. Use this only if ContentSecurityPolicyDefaultSource and ContentSecurityPolicyScriptSource do not meet your needs. & $directives:Array of CSP directives $policyConfig:Current configuration for the CSP header $mode:ContentSecurityPolicy::REPORT_ONLY_MODE or ContentSecurityPolicy::FULL_MODE depending on type of header 'ContentSecurityPolicyScriptSource':Modify the allowed CSP script sources. Note that you also have to use ContentSecurityPolicyDefaultSource if you want non-script sources to be loaded from whatever you add. & $scriptSrc:Array of CSP directives $policyConfig:Current configuration for the CSP header $mode:ContentSecurityPolicy::REPORT_ONLY_MODE or ContentSecurityPolicy::FULL_MODE depending on type of header 'CustomEditor':When invoking the page editor Return true to allow the normal editor to be used, or false if implementing a custom editor, e.g. for a special namespace, etc. $article:Article being edited $user:User performing the edit 'DatabaseOraclePostInit':Called after initialising an Oracle database $db:the DatabaseOracle object 'DeletedContribsPager::reallyDoQuery':Called before really executing the query for Special:DeletedContributions Similar to ContribsPager::reallyDoQuery & $data:an array of results of all contribs queries $pager:The DeletedContribsPager object hooked into $offset:Index offset, inclusive $limit:Exact query limit $descending:Query direction, false for ascending, true for descending 'DeletedContributionsLineEnding':Called before a DeletedContributions HTML line is finished. Similar to ContributionsLineEnding $page:SpecialPage object for DeletedContributions & $ret:the HTML line $row:the DB row for this line & $classes:the classes to add to the surrounding< li > & $attribs:associative array of other HTML attributes for the< li > element. Currently only data attributes reserved to MediaWiki are allowed(see Sanitizer::isReservedDataAttribute). 'DeleteUnknownPreferences':Called by the cleanupPreferences.php maintenance script to build a WHERE clause with which to delete preferences that are not known about. This hook is used by extensions that have dynamically-named preferences that should not be deleted in the usual cleanup process. For example, the Gadgets extension creates preferences prefixed with 'gadget-', and so anything with that prefix is excluded from the deletion. &where:An array that will be passed as the $cond parameter to IDatabase::select() to determine what will be deleted from the user_properties table. $db:The IDatabase object, useful for accessing $db->buildLike() etc. 'DifferenceEngineAfterLoadNewText':called in DifferenceEngine::loadNewText() after the new revision 's content has been loaded into the class member variable $differenceEngine->mNewContent but before returning true from this function. $differenceEngine:DifferenceEngine object 'DifferenceEngineLoadTextAfterNewContentIsLoaded':called in DifferenceEngine::loadText() after the new revision 's content has been loaded into the class member variable $differenceEngine->mNewContent but before checking if the variable 's value is null. This hook can be used to inject content into said class member variable. $differenceEngine:DifferenceEngine object 'DifferenceEngineMarkPatrolledLink':Allows extensions to change the "mark as patrolled" link which is shown both on the diff header as well as on the bottom of a page, usually wrapped in a span element which has class="patrollink". $differenceEngine:DifferenceEngine object & $markAsPatrolledLink:The "mark as patrolled" link HTML(string) $rcid:Recent change ID(rc_id) for this change(int) 'DifferenceEngineMarkPatrolledRCID':Allows extensions to possibly change the rcid parameter. For example the rcid might be set to zero due to the user being the same as the performer of the change but an extension might still want to show it under certain conditions. & $rcid:rc_id(int) of the change or 0 $differenceEngine:DifferenceEngine object $change:RecentChange object $user:User object representing the current user 'DifferenceEngineNewHeader':Allows extensions to change the $newHeader variable, which contains information about the new revision, such as the revision 's author, whether the revision was marked as a minor edit or not, etc. $differenceEngine:DifferenceEngine object & $newHeader:The string containing the various #mw-diff-otitle[1-5] divs, which include things like revision author info, revision comment, RevisionDelete link and more $formattedRevisionTools:Array containing revision tools, some of which may have been injected with the DiffRevisionTools hook $nextlink:String containing the link to the next revision(if any) $status
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 & $options
namespace and then decline to actually register it file or subcat img or subcat $title
return true to allow those checks to and false if checking is done & $user
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
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
Base interface for content objects.
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))
$page->newPageUpdater($user) $updater