29 if ( $returnTextIdField ) {
30 $fields[] =
'rev_text_id';
49 if ( $returnTextFields ) {
50 $fields[] =
'ar_text_id';
57 "{$prefix}_comment_text" =>
"comment_{$prefix}_comment.comment_text",
58 "{$prefix}_comment_data" =>
"comment_{$prefix}_comment.comment_data",
59 "{$prefix}_comment_cid" =>
"comment_{$prefix}_comment.comment_id",
65 "{$prefix}_user" =>
"{$prefix}_user",
66 "{$prefix}_user_text" =>
"{$prefix}_user_text",
67 "{$prefix}_actor" =>
'NULL',
73 "{$prefix}_user" =>
"actor_{$prefix}_user.actor_user",
74 "{$prefix}_user_text" =>
"actor_{$prefix}_user.actor_name",
75 "{$prefix}_actor" => $tmp ?:
"{$prefix}_actor",
81 "temp_{$prefix}_user" => [
83 "temp_{$prefix}_user.revactor_{$prefix} = {$prefix}_id",
85 "actor_{$prefix}_user" => [
87 "actor_{$prefix}_user.actor_id = temp_{$prefix}_user.revactor_actor",
118 "{$prefix}_content_format",
119 "{$prefix}_content_model",
124 yield
'MCR, comment, actor' => [
132 'actor_ar_user' =>
'actor',
133 'comment_ar_comment' =>
'comment',
135 'fields' => array_merge(
142 => [
'JOIN',
'comment_ar_comment.comment_id = ar_comment_id' ],
143 'actor_ar_user' => [
'JOIN',
'actor_ar_user.actor_id = ar_actor' ],
147 yield
'read-new MCR, comment, actor' => [
149 'wgContentHandlerUseDB' =>
true,
150 'wgMultiContentRevisionSchemaMigrationStage'
157 'actor_ar_user' =>
'actor',
158 'comment_ar_comment' =>
'comment',
160 'fields' => array_merge(
167 => [
'JOIN',
'comment_ar_comment.comment_id = ar_comment_id' ],
168 'actor_ar_user' => [
'JOIN',
'actor_ar_user.actor_id = ar_actor' ],
172 yield
'MCR write-both/read-old' => [
174 'wgContentHandlerUseDB' =>
true,
175 'wgMultiContentRevisionSchemaMigrationStage'
182 'comment_ar_comment' =>
'comment',
184 'fields' => array_merge(
192 => [
'JOIN',
'comment_ar_comment.comment_id = ar_comment_id' ],
196 yield
'pre-MCR, no model' => [
198 'wgContentHandlerUseDB' =>
false,
205 'comment_ar_comment' =>
'comment',
207 'fields' => array_merge(
214 => [
'JOIN',
'comment_ar_comment.comment_id = ar_comment_id' ],
222 yield
'MCR, page, user, comment, actor' => [
224 'wgContentHandlerUseDB' =>
true,
234 'temp_rev_user' =>
'revision_actor_temp',
235 'temp_rev_comment' =>
'revision_comment_temp',
236 'actor_rev_user' =>
'actor',
237 'comment_rev_comment' =>
'comment',
239 'fields' => array_merge(
247 'page' => [
'JOIN', [
'page_id = rev_page' ] ],
250 [
'actor_rev_user.actor_user != 0',
'user_id = actor_rev_user.actor_user' ],
252 'comment_rev_comment' => [
254 'comment_rev_comment.comment_id = temp_rev_comment.revcomment_comment_id',
256 'actor_rev_user' => [
258 'actor_rev_user.actor_id = temp_rev_user.revactor_actor',
260 'temp_rev_user' => [
'JOIN',
'temp_rev_user.revactor_rev = rev_id' ],
261 'temp_rev_comment' => [
'JOIN',
'temp_rev_comment.revcomment_rev = rev_id' ],
265 yield
'MCR read-new, page, user, comment, actor' => [
267 'wgContentHandlerUseDB' =>
true,
268 'wgMultiContentRevisionSchemaMigrationStage'
278 'temp_rev_user' =>
'revision_actor_temp',
279 'temp_rev_comment' =>
'revision_comment_temp',
280 'actor_rev_user' =>
'actor',
281 'comment_rev_comment' =>
'comment',
283 'fields' => array_merge(
290 'joins' => array_merge(
292 'page' => [
'JOIN', [
'page_id = rev_page' ] ],
296 'actor_rev_user.actor_user != 0',
297 'user_id = actor_rev_user.actor_user',
300 'temp_rev_comment' => [
'JOIN',
'temp_rev_comment.revcomment_rev = rev_id' ],
301 'comment_rev_comment'
302 => [
'JOIN',
'comment_rev_comment.comment_id = temp_rev_comment.revcomment_comment_id' ],
308 yield
'MCR read-new' => [
310 'wgContentHandlerUseDB' =>
true,
311 'wgMultiContentRevisionSchemaMigrationStage'
321 'temp_rev_user' =>
'revision_actor_temp',
322 'temp_rev_comment' =>
'revision_comment_temp',
323 'actor_rev_user' =>
'actor',
324 'comment_rev_comment' =>
'comment',
326 'fields' => array_merge(
333 'joins' => array_merge(
335 'page' => [
'JOIN', [
'page_id = rev_page' ] ],
339 'actor_rev_user.actor_user != 0',
340 'user_id = actor_rev_user.actor_user'
343 'temp_rev_comment' => [
'JOIN',
'temp_rev_comment.revcomment_rev = rev_id' ],
344 'comment_rev_comment'
345 => [
'JOIN',
'comment_rev_comment.comment_id = temp_rev_comment.revcomment_comment_id' ],
351 yield
'MCR write-both/read-old' => [
353 'wgContentHandlerUseDB' =>
true,
354 'wgMultiContentRevisionSchemaMigrationStage'
362 'temp_rev_comment' =>
'revision_comment_temp',
363 'comment_rev_comment' =>
'comment',
365 'fields' => array_merge(
372 'temp_rev_comment' => [
'JOIN',
'temp_rev_comment.revcomment_rev = rev_id' ],
373 'comment_rev_comment'
374 => [
'JOIN',
'comment_rev_comment.comment_id = temp_rev_comment.revcomment_comment_id' ],
378 yield
'MCR write-both/read-old, page, user' => [
380 'wgContentHandlerUseDB' =>
true,
381 'wgMultiContentRevisionSchemaMigrationStage'
391 'temp_rev_comment' =>
'revision_comment_temp',
392 'comment_rev_comment' =>
'comment',
394 'fields' => array_merge(
402 'joins' => array_merge(
404 'page' => [
'JOIN', [
'page_id = rev_page' ] ],
412 'temp_rev_comment' => [
'JOIN',
'temp_rev_comment.revcomment_rev = rev_id' ],
413 'comment_rev_comment'
414 => [
'JOIN',
'comment_rev_comment.comment_id = temp_rev_comment.revcomment_comment_id' ],
421 'wgContentHandlerUseDB' =>
true,
429 'temp_rev_comment' =>
'revision_comment_temp',
430 'comment_rev_comment' =>
'comment',
432 'fields' => array_merge(
439 'temp_rev_comment' => [
'JOIN',
'temp_rev_comment.revcomment_rev = rev_id' ],
440 'comment_rev_comment'
441 => [
'JOIN',
'comment_rev_comment.comment_id = temp_rev_comment.revcomment_comment_id' ],
445 yield
'pre-MCR, page, user' => [
447 'wgContentHandlerUseDB' =>
true,
454 'revision',
'page',
'user',
455 'temp_rev_comment' =>
'revision_comment_temp',
456 'comment_rev_comment' =>
'comment',
458 'fields' => array_merge(
467 'page' => [
'JOIN', [
'page_id = rev_page' ] ],
468 'user' => [
'LEFT JOIN', [
'rev_user != 0',
'user_id = rev_user' ] ],
469 'temp_rev_comment' => [
'JOIN',
'temp_rev_comment.revcomment_rev = rev_id' ],
470 'comment_rev_comment'
471 => [
'JOIN',
'comment_rev_comment.comment_id = temp_rev_comment.revcomment_comment_id' ],
475 yield
'pre-MCR, no model' => [
477 'wgContentHandlerUseDB' =>
false,
485 'temp_rev_comment' =>
'revision_comment_temp',
486 'comment_rev_comment' =>
'comment',
488 'fields' => array_merge(
494 'temp_rev_comment' => [
'JOIN',
'temp_rev_comment.revcomment_rev = rev_id' ],
495 'comment_rev_comment'
496 => [
'JOIN',
'comment_rev_comment.comment_id = temp_rev_comment.revcomment_comment_id' ],
500 yield
'pre-MCR, no model, page' => [
502 'wgContentHandlerUseDB' =>
false,
510 'temp_rev_comment' =>
'revision_comment_temp',
511 'comment_rev_comment' =>
'comment',
513 'fields' => array_merge(
520 'page' => [
'JOIN', [
'page_id = rev_page' ], ],
521 'temp_rev_comment' => [
'JOIN',
'temp_rev_comment.revcomment_rev = rev_id' ],
522 'comment_rev_comment'
523 => [
'JOIN',
'comment_rev_comment.comment_id = temp_rev_comment.revcomment_comment_id' ],
527 yield
'pre-MCR, no model, user' => [
529 'wgContentHandlerUseDB' =>
false,
537 'temp_rev_comment' =>
'revision_comment_temp',
538 'comment_rev_comment' =>
'comment',
540 'fields' => array_merge(
547 'user' => [
'LEFT JOIN', [
'rev_user != 0',
'user_id = rev_user' ] ],
548 'temp_rev_comment' => [
'JOIN',
'temp_rev_comment.revcomment_rev = rev_id' ],
549 'comment_rev_comment'
550 => [
'JOIN',
'comment_rev_comment.comment_id = temp_rev_comment.revcomment_comment_id' ],
554 yield
'pre-MCR, no model, text' => [
556 'wgContentHandlerUseDB' =>
false,
564 'temp_rev_comment' =>
'revision_comment_temp',
565 'comment_rev_comment' =>
'comment',
567 'fields' => array_merge(
574 'text' => [
'JOIN', [
'rev_text_id=old_id' ] ],
575 'temp_rev_comment' => [
'JOIN',
'temp_rev_comment.revcomment_rev = rev_id' ],
576 'comment_rev_comment'
577 => [
'JOIN',
'comment_rev_comment.comment_id = temp_rev_comment.revcomment_comment_id' ],
581 yield
'pre-MCR, no model, text, page, user' => [
583 'wgContentHandlerUseDB' =>
false,
587 [
'text',
'page',
'user' ],
590 'revision',
'page',
'user',
'text',
591 'temp_rev_comment' =>
'revision_comment_temp',
592 'comment_rev_comment' =>
'comment',
594 'fields' => array_merge(
605 [
'page_id = rev_page' ],
611 'user_id = rev_user',
616 [
'rev_text_id=old_id' ],
618 'temp_rev_comment' => [
'JOIN',
'temp_rev_comment.revcomment_rev = rev_id' ],
619 'comment_rev_comment'
620 => [
'JOIN',
'comment_rev_comment.comment_id = temp_rev_comment.revcomment_comment_id' ],
627 yield
'MCR, no options' => [
645 yield
'MCR, role option' => [
663 'slot_roles' => [
'LEFT JOIN', [
'slot_role_id = role_id' ] ],
667 yield
'MCR read-new, content option' => [
669 'wgMultiContentRevisionSchemaMigrationStage'
689 'content' => [
'JOIN', [
'slot_content_id = content_id' ] ],
693 yield
'MCR read-new, content and model options' => [
695 'wgMultiContentRevisionSchemaMigrationStage'
698 [
'content',
'model' ],
717 'content' => [
'JOIN', [
'slot_content_id = content_id' ] ],
718 'content_models' => [
'LEFT JOIN', [
'content_model = model_id' ] ],
725 yield
'MCR write-both/read-old' => [
727 'wgMultiContentRevisionSchemaMigrationStage'
733 'slots' =>
'revision',
735 'fields' => array_merge(
737 'slot_revision_id' =>
'slots.rev_id',
738 'slot_content_id' =>
'NULL',
739 'slot_origin' =>
'slots.rev_id',
746 yield
'MCR write-both/read-old, content' => [
748 'wgMultiContentRevisionSchemaMigrationStage'
754 'slots' =>
'revision',
756 'fields' => array_merge(
758 'slot_revision_id' =>
'slots.rev_id',
759 'slot_content_id' =>
'NULL',
760 'slot_origin' =>
'slots.rev_id',
762 'content_size' =>
'slots.rev_len',
763 'content_sha1' =>
'slots.rev_sha1',
766 'model_name' =>
'slots.rev_content_model',
772 yield
'MCR write-both/read-old, content, model, role' => [
774 'wgMultiContentRevisionSchemaMigrationStage'
777 [
'content',
'model',
'role' ],
780 'slots' =>
'revision',
782 'fields' => array_merge(
784 'slot_revision_id' =>
'slots.rev_id',
785 'slot_content_id' =>
'NULL',
786 'slot_origin' =>
'slots.rev_id',
788 'content_size' =>
'slots.rev_len',
789 'content_sha1' =>
'slots.rev_sha1',
792 'model_name' =>
'slots.rev_content_model',
800 'wgMultiContentRevisionSchemaMigrationStage'
806 'slots' =>
'revision',
808 'fields' => array_merge(
810 'slot_revision_id' =>
'slots.rev_id',
811 'slot_content_id' =>
'NULL',
812 'slot_origin' =>
'slots.rev_id',
819 yield
'pre-MCR, content' => [
821 'wgMultiContentRevisionSchemaMigrationStage'
827 'slots' =>
'revision',
829 'fields' => array_merge(
831 'slot_revision_id' =>
'slots.rev_id',
832 'slot_content_id' =>
'NULL',
833 'slot_origin' =>
'slots.rev_id',
835 'content_size' =>
'slots.rev_len',
836 'content_sha1' =>
'slots.rev_sha1',
839 'model_name' =>
'slots.rev_content_model',
848 yield
'with model, comment, and actor' => [
850 'wgContentHandlerUseDB' =>
true,
853 'fields' => array_merge(
861 'rev_actor' =>
'NULL',
870 'rev_comment_pk' =>
'rev_id',
874 yield
'no mode, no comment, no actor' => [
876 'wgContentHandlerUseDB' =>
false,
879 'fields' => array_merge(
887 'rev_actor' =>
'NULL',
893 'rev_comment_pk' =>
'rev_id',
900 yield
'with model, comment, and actor' => [
902 'wgContentHandlerUseDB' =>
true,
905 'fields' => array_merge(
914 'ar_actor' =>
'NULL',
923 'ar_comment_id' =>
'ar_comment_id',
927 yield
'no mode, no comment, no actor' => [
929 'wgContentHandlerUseDB' =>
false,
932 'fields' => array_merge(
941 'ar_actor' =>
'NULL',
947 'ar_comment_id' =>
'ar_comment_id',
985 [
'LEFT JOIN', [
'rev_user != 0',
'user_id = rev_user' ] ],
996 [
'JOIN', [
'page_id = rev_page' ] ],
1006 $this->assertEquals(
1017 $this->assertEquals(
1028 $this->assertEquals(
1068 $queryInfo = $store->getQueryInfo(
$options );
1077 $migrationStageSettings,
1086 $queryInfo = $store->getSlotsQueryInfo(
$options );
1100 $queryInfo = $store->getArchiveQueryInfo();
1106 $expected[
'tables'],
1107 $queryInfo[
'tables'],
1111 $expected[
'fields'],
1112 $queryInfo[
'fields'],
1117 $queryInfo[
'joins'],
1142 $expectedIntKeyValues = [];
1143 $actualIntKeyValues = [];
1148 foreach ( $expected
as $key =>
$value ) {
1149 if ( is_int( $key ) ) {
1150 unset( $expected[$key] );
1151 $expectedIntKeyValues[] =
$value;
1154 foreach ( $actual
as $key =>
$value ) {
1155 if ( is_int( $key ) ) {
1156 unset( $actual[$key] );
1157 $actualIntKeyValues[] =
$value;
1167 $this->assertEquals( $expected, $actual, $message );
1168 $this->assertEquals( $expectedIntKeyValues, $actualIntKeyValues, $message );
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
static selectArchiveFields()
Return the list of revision fields that should be selected to create a new revision from an archive r...
static userJoinCond()
Return the value of a select() JOIN conds array for the user table.
static selectTextFields()
Return the list of text fields that should be selected to read the revision text.
static selectPageFields()
Return the list of page fields that should be selected from page table.
static selectFields()
Return the list of revision fields that should be selected to create a new revision.
static getArchiveQueryInfo()
Return the tables, fields, and join conditions to be selected to create a new archived revision objec...
static selectUserFields()
Return the list of user fields that should be selected from user table.
static pageJoinCond()
Return the value of a select() page conds array for the page table.
static getQueryInfo( $options=[])
Return the tables, fields, and join conditions to be selected to create a new revision object.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
const SCHEMA_COMPAT_WRITE_BOTH
const SCHEMA_COMPAT_READ_NEW
const SCHEMA_COMPAT_READ_OLD
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
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))