Go to the documentation of this file.
29 if ( $returnTextIdField ) {
30 $fields[] =
'rev_text_id';
49 if ( $returnTextFields ) {
50 $fields[] =
'ar_text_id';
57 "{$prefix}_comment_text" =>
"{$prefix}_comment",
58 "{$prefix}_comment_data" =>
'NULL',
59 "{$prefix}_comment_cid" =>
'NULL',
65 "{$prefix}_comment_text"
66 =>
"COALESCE( comment_{$prefix}_comment.comment_text, {$prefix}_comment )",
67 "{$prefix}_comment_data" =>
"comment_{$prefix}_comment.comment_data",
68 "{$prefix}_comment_cid" =>
"comment_{$prefix}_comment.comment_id",
74 "{$prefix}_comment_text" =>
"comment_{$prefix}_comment.comment_text",
75 "{$prefix}_comment_data" =>
"comment_{$prefix}_comment.comment_data",
76 "{$prefix}_comment_cid" =>
"comment_{$prefix}_comment.comment_id",
82 "{$prefix}_user" =>
"{$prefix}_user",
83 "{$prefix}_user_text" =>
"{$prefix}_user_text",
84 "{$prefix}_actor" =>
'NULL',
90 "{$prefix}_user" =>
"actor_{$prefix}_user.actor_user",
91 "{$prefix}_user_text" =>
"actor_{$prefix}_user.actor_name",
92 "{$prefix}_actor" => $tmp ?:
"{$prefix}_actor",
98 "temp_{$prefix}_user" => [
100 "temp_{$prefix}_user.revactor_{$prefix} = {$prefix}_id",
102 "actor_{$prefix}_user" => [
104 "actor_{$prefix}_user.actor_id = temp_{$prefix}_user.revactor_actor",
111 "temp_{$prefix}_comment" => [
113 "temp_{$prefix}_comment.revcomment_{$prefix} = {$prefix}_id",
115 "comment_{$prefix}_comment" => [
117 "comment_{$prefix}_comment.comment_id = temp_{$prefix}_comment.revcomment_comment_id",
148 "{$prefix}_content_format",
149 "{$prefix}_content_model",
154 yield
'MCR, comment, actor' => [
163 'actor_ar_user' =>
'actor',
164 'comment_ar_comment' =>
'comment',
166 'fields' => array_merge(
173 => [
'JOIN',
'comment_ar_comment.comment_id = ar_comment_id' ],
174 'actor_ar_user' => [
'JOIN',
'actor_ar_user.actor_id = ar_actor' ],
178 yield
'read-new MCR, comment, actor' => [
180 'wgContentHandlerUseDB' =>
true,
181 'wgMultiContentRevisionSchemaMigrationStage'
189 'actor_ar_user' =>
'actor',
190 'comment_ar_comment' =>
'comment',
192 'fields' => array_merge(
199 => [
'LEFT JOIN',
'comment_ar_comment.comment_id = ar_comment_id' ],
200 'actor_ar_user' => [
'JOIN',
'actor_ar_user.actor_id = ar_actor' ],
204 yield
'MCR write-both/read-old' => [
206 'wgContentHandlerUseDB' =>
true,
207 'wgMultiContentRevisionSchemaMigrationStage'
215 'comment_ar_comment' =>
'comment',
217 'fields' => array_merge(
225 => [
'LEFT JOIN',
'comment_ar_comment.comment_id = ar_comment_id' ],
229 yield
'pre-MCR, no model' => [
231 'wgContentHandlerUseDB' =>
false,
240 'fields' => array_merge(
252 yield
'MCR, page, user, comment, actor' => [
254 'wgContentHandlerUseDB' =>
true,
265 'temp_rev_user' =>
'revision_actor_temp',
266 'temp_rev_comment' =>
'revision_comment_temp',
267 'actor_rev_user' =>
'actor',
268 'comment_rev_comment' =>
'comment',
270 'fields' => array_merge(
278 'page' => [
'INNER JOIN', [
'page_id = rev_page' ] ],
281 [
'actor_rev_user.actor_user != 0',
'user_id = actor_rev_user.actor_user' ],
283 'comment_rev_comment' => [
285 'comment_rev_comment.comment_id = temp_rev_comment.revcomment_comment_id',
287 'actor_rev_user' => [
289 'actor_rev_user.actor_id = temp_rev_user.revactor_actor',
291 'temp_rev_user' => [
'JOIN',
'temp_rev_user.revactor_rev = rev_id' ],
292 'temp_rev_comment' => [
'JOIN',
'temp_rev_comment.revcomment_rev = rev_id' ],
296 yield
'MCR read-new, page, user, comment, actor' => [
298 'wgContentHandlerUseDB' =>
true,
299 'wgMultiContentRevisionSchemaMigrationStage'
310 'temp_rev_user' =>
'revision_actor_temp',
311 'temp_rev_comment' =>
'revision_comment_temp',
312 'actor_rev_user' =>
'actor',
313 'comment_rev_comment' =>
'comment',
315 'fields' => array_merge(
322 'joins' => array_merge(
324 'page' => [
'INNER JOIN', [
'page_id = rev_page' ] ],
328 'actor_rev_user.actor_user != 0',
329 'user_id = actor_rev_user.actor_user',
338 yield
'MCR read-new' => [
340 'wgContentHandlerUseDB' =>
true,
341 'wgMultiContentRevisionSchemaMigrationStage'
352 'temp_rev_user' =>
'revision_actor_temp',
353 'temp_rev_comment' =>
'revision_comment_temp',
354 'actor_rev_user' =>
'actor',
355 'comment_rev_comment' =>
'comment',
357 'fields' => array_merge(
364 'joins' => array_merge(
366 'page' => [
'INNER JOIN', [
'page_id = rev_page' ] ],
370 'actor_rev_user.actor_user != 0',
371 'user_id = actor_rev_user.actor_user'
380 yield
'MCR write-both/read-old' => [
382 'wgContentHandlerUseDB' =>
true,
383 'wgMultiContentRevisionSchemaMigrationStage'
392 'temp_rev_comment' =>
'revision_comment_temp',
393 'comment_rev_comment' =>
'comment',
395 'fields' => array_merge(
401 'joins' => array_merge(
406 yield
'MCR write-both/read-old, page, user' => [
408 'wgContentHandlerUseDB' =>
true,
409 'wgMultiContentRevisionSchemaMigrationStage'
420 'temp_rev_comment' =>
'revision_comment_temp',
421 'comment_rev_comment' =>
'comment',
423 'fields' => array_merge(
431 'joins' => array_merge(
433 'page' => [
'INNER JOIN', [
'page_id = rev_page' ] ],
448 'wgContentHandlerUseDB' =>
true,
455 'tables' => [
'revision' ],
456 'fields' => array_merge(
465 yield
'pre-MCR, page, user' => [
467 'wgContentHandlerUseDB' =>
true,
474 'tables' => [
'revision',
'page',
'user' ],
475 'fields' => array_merge(
484 'page' => [
'INNER JOIN', [
'page_id = rev_page' ] ],
485 'user' => [
'LEFT JOIN', [
'rev_user != 0',
'user_id = rev_user' ] ],
489 yield
'pre-MCR, no model' => [
491 'wgContentHandlerUseDB' =>
false,
498 'tables' => [
'revision' ],
499 'fields' => array_merge(
507 yield
'pre-MCR, no model, page' => [
509 'wgContentHandlerUseDB' =>
false,
516 'tables' => [
'revision',
'page' ],
517 'fields' => array_merge(
524 'page' => [
'INNER JOIN', [
'page_id = rev_page' ], ],
528 yield
'pre-MCR, no model, user' => [
530 'wgContentHandlerUseDB' =>
false,
537 'tables' => [
'revision',
'user' ],
538 'fields' => array_merge(
545 'user' => [
'LEFT JOIN', [
'rev_user != 0',
'user_id = rev_user' ] ],
549 yield
'pre-MCR, no model, text' => [
551 'wgContentHandlerUseDB' =>
false,
558 'tables' => [
'revision',
'text' ],
559 'fields' => array_merge(
566 'text' => [
'INNER JOIN', [
'rev_text_id=old_id' ] ],
570 yield
'pre-MCR, no model, text, page, user' => [
572 'wgContentHandlerUseDB' =>
false,
577 [
'text',
'page',
'user' ],
580 'revision',
'page',
'user',
'text'
582 'fields' => array_merge(
593 [
'page_id = rev_page' ],
599 'user_id = rev_user',
604 [
'rev_text_id=old_id' ],
612 yield
'MCR, no options' => [
630 yield
'MCR, role option' => [
648 'slot_roles' => [
'LEFT JOIN', [
'slot_role_id = role_id' ] ],
652 yield
'MCR read-new, content option' => [
654 'wgMultiContentRevisionSchemaMigrationStage'
674 'content' => [
'INNER JOIN', [
'slot_content_id = content_id' ] ],
678 yield
'MCR read-new, content and model options' => [
680 'wgMultiContentRevisionSchemaMigrationStage'
683 [
'content',
'model' ],
702 'content' => [
'INNER JOIN', [
'slot_content_id = content_id' ] ],
703 'content_models' => [
'LEFT JOIN', [
'content_model = model_id' ] ],
710 yield
'MCR write-both/read-old' => [
712 'wgMultiContentRevisionSchemaMigrationStage'
718 'slots' =>
'revision',
720 'fields' => array_merge(
722 'slot_revision_id' =>
'slots.rev_id',
723 'slot_content_id' =>
'NULL',
724 'slot_origin' =>
'slots.rev_id',
731 yield
'MCR write-both/read-old, content' => [
733 'wgMultiContentRevisionSchemaMigrationStage'
739 'slots' =>
'revision',
741 'fields' => array_merge(
743 'slot_revision_id' =>
'slots.rev_id',
744 'slot_content_id' =>
'NULL',
745 'slot_origin' =>
'slots.rev_id',
747 'content_size' =>
'slots.rev_len',
748 'content_sha1' =>
'slots.rev_sha1',
749 'content_address' =>
$db->buildConcat( [
750 $db->addQuotes(
'tt:' ),
'slots.rev_text_id' ] ),
751 'model_name' =>
'slots.rev_content_model',
757 yield
'MCR write-both/read-old, content, model, role' => [
759 'wgMultiContentRevisionSchemaMigrationStage'
762 [
'content',
'model',
'role' ],
765 'slots' =>
'revision',
767 'fields' => array_merge(
769 'slot_revision_id' =>
'slots.rev_id',
770 'slot_content_id' =>
'NULL',
771 'slot_origin' =>
'slots.rev_id',
773 'content_size' =>
'slots.rev_len',
774 'content_sha1' =>
'slots.rev_sha1',
775 'content_address' =>
$db->buildConcat( [
776 $db->addQuotes(
'tt:' ),
'slots.rev_text_id' ] ),
777 'model_name' =>
'slots.rev_content_model',
785 'wgMultiContentRevisionSchemaMigrationStage'
791 'slots' =>
'revision',
793 'fields' => array_merge(
795 'slot_revision_id' =>
'slots.rev_id',
796 'slot_content_id' =>
'NULL',
797 'slot_origin' =>
'slots.rev_id',
804 yield
'pre-MCR, content' => [
806 'wgMultiContentRevisionSchemaMigrationStage'
812 'slots' =>
'revision',
814 'fields' => array_merge(
816 'slot_revision_id' =>
'slots.rev_id',
817 'slot_content_id' =>
'NULL',
818 'slot_origin' =>
'slots.rev_id',
820 'content_size' =>
'slots.rev_len',
821 'content_sha1' =>
'slots.rev_sha1',
823 $db->buildConcat( [
$db->addQuotes(
'tt:' ),
'slots.rev_text_id' ] ),
824 'model_name' =>
'slots.rev_content_model',
833 yield
'with model, comment, and actor' => [
835 'wgContentHandlerUseDB' =>
true,
839 'fields' => array_merge(
847 'rev_actor' =>
'NULL',
856 'rev_comment_old' =>
'rev_comment',
857 'rev_comment_pk' =>
'rev_id',
861 yield
'no mode, no comment, no actor' => [
863 'wgContentHandlerUseDB' =>
false,
867 'fields' => array_merge(
875 'rev_actor' =>
'NULL',
888 yield
'with model, comment, and actor' => [
890 'wgContentHandlerUseDB' =>
true,
894 'fields' => array_merge(
903 'ar_actor' =>
'NULL',
912 'ar_comment_old' =>
'ar_comment',
913 'ar_comment_id' =>
'ar_comment_id',
917 yield
'no mode, no comment, no actor' => [
919 'wgContentHandlerUseDB' =>
false,
923 'fields' => array_merge(
932 'ar_actor' =>
'NULL',
976 [
'LEFT JOIN', [
'rev_user != 0',
'user_id = rev_user' ] ],
987 [
'INNER JOIN', [
'page_id = rev_page' ] ],
1008 $this->assertEquals(
1019 $this->assertEquals(
1059 $queryInfo = $store->getQueryInfo(
$options );
1068 $migrationStageSettings,
1077 $queryInfo = $store->getSlotsQueryInfo(
$options );
1091 $queryInfo = $store->getArchiveQueryInfo();
1097 $expected[
'tables'],
1098 $queryInfo[
'tables'],
1102 $expected[
'fields'],
1103 $queryInfo[
'fields'],
1108 $queryInfo[
'joins'],
1133 $expectedIntKeyValues = [];
1134 $actualIntKeyValues = [];
1139 foreach ( $expected
as $key =>
$value ) {
1140 if ( is_int( $key ) ) {
1141 unset( $expected[$key] );
1142 $expectedIntKeyValues[] =
$value;
1145 foreach ( $actual
as $key =>
$value ) {
1146 if ( is_int( $key ) ) {
1147 unset( $actual[$key] );
1148 $actualIntKeyValues[] =
$value;
1158 $this->assertEquals( $expected, $actual, $message );
1159 $this->assertEquals( $expectedIntKeyValues, $actualIntKeyValues, $message );
const SCHEMA_COMPAT_READ_NEW
static pageJoinCond()
Return the value of a select() page conds array for the page table.
const MIGRATION_WRITE_BOTH
static getArchiveQueryInfo()
Return the tables, fields, and join conditions to be selected to create a new archived revision objec...
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
const MIGRATION_WRITE_NEW
static selectTextFields()
Return the list of text fields that should be selected to read the revision text.
static getQueryInfo( $options=[])
Return the tables, fields, and join conditions to be selected to create a new revision object.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
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))
static selectPageFields()
Return the list of page fields that should be selected from page table.
static selectArchiveFields()
Return the list of revision fields that should be selected to create a new revision from an archive r...
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
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
static userJoinCond()
Return the value of a select() JOIN conds array for the user table.
const SCHEMA_COMPAT_WRITE_BOTH
static selectUserFields()
Return the list of user fields that should be selected from user table.
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 MediaWikiServices
static selectFields()
Return the list of revision fields that should be selected to create a new revision.
const SCHEMA_COMPAT_READ_OLD