MediaWiki REL1_33
NoContentModelRevisionStoreDbTest.php
Go to the documentation of this file.
1<?php
3
5
17
19
20 protected function getContentHandlerUseDB() {
21 return false;
22 }
23
24 protected function revisionToRow( Revision $rev, $options = [ 'page', 'user', 'comment' ] ) {
25 $row = parent::revisionToRow( $rev, $options );
26
27 $row->rev_text_id = (string)$rev->getTextId();
28
29 return $row;
30 }
31
32 public function provideGetArchiveQueryInfo() {
33 yield [
34 [
35 'tables' => [ 'archive' ],
36 'fields' => array_merge(
37 $this->getDefaultArchiveFields(),
38 [
39 'ar_comment_text' => 'ar_comment',
40 'ar_comment_data' => 'NULL',
41 'ar_comment_cid' => 'NULL',
42 'ar_user_text' => 'ar_user_text',
43 'ar_user' => 'ar_user',
44 'ar_actor' => 'NULL',
45 ]
46 ),
47 'joins' => [],
48 ]
49 ];
50 }
51
52 public function provideGetQueryInfo() {
53 yield [
54 [],
55 [
56 'tables' => [ 'revision' ],
57 'fields' => array_merge(
58 $this->getDefaultQueryFields(),
59 $this->getCommentQueryFields(),
60 $this->getActorQueryFields()
61 ),
62 'joins' => [],
63 ]
64 ];
65 yield [
66 [ 'page' ],
67 [
68 'tables' => [ 'revision', 'page' ],
69 'fields' => array_merge(
70 $this->getDefaultQueryFields(),
71 $this->getCommentQueryFields(),
72 $this->getActorQueryFields(),
73 [
74 'page_namespace',
75 'page_title',
76 'page_id',
77 'page_latest',
78 'page_is_redirect',
79 'page_len',
80 ]
81 ),
82 'joins' => [
83 'page' => [ 'JOIN', [ 'page_id = rev_page' ] ],
84 ],
85 ]
86 ];
87 yield [
88 [ 'user' ],
89 [
90 'tables' => [ 'revision', 'user' ],
91 'fields' => array_merge(
92 $this->getDefaultQueryFields(),
93 $this->getCommentQueryFields(),
94 $this->getActorQueryFields(),
95 [
96 'user_name',
97 ]
98 ),
99 'joins' => [
100 'user' => [ 'LEFT JOIN', [ 'rev_user != 0', 'user_id = rev_user' ] ],
101 ],
102 ]
103 ];
104 yield [
105 [ 'text' ],
106 [
107 'tables' => [ 'revision', 'text' ],
108 'fields' => array_merge(
109 $this->getDefaultQueryFields(),
110 $this->getCommentQueryFields(),
111 $this->getActorQueryFields(),
112 [
113 'old_text',
114 'old_flags',
115 ]
116 ),
117 'joins' => [
118 'text' => [ 'JOIN', [ 'rev_text_id=old_id' ] ],
119 ],
120 ]
121 ];
122 }
123
124 public function provideGetSlotsQueryInfo() {
126
127 yield [
128 [],
129 [
130 'tables' => [
131 'slots' => 'revision',
132 ],
133 'fields' => array_merge(
134 [
135 'slot_revision_id' => 'slots.rev_id',
136 'slot_content_id' => 'NULL',
137 'slot_origin' => 'slots.rev_id',
138 'role_name' => $db->addQuotes( SlotRecord::MAIN ),
139 ]
140 ),
141 'joins' => [],
142 ]
143 ];
144 yield [
145 [ 'content' ],
146 [
147 'tables' => [
148 'slots' => 'revision',
149 ],
150 'fields' => array_merge(
151 [
152 'slot_revision_id' => 'slots.rev_id',
153 'slot_content_id' => 'NULL',
154 'slot_origin' => 'slots.rev_id',
155 'role_name' => $db->addQuotes( SlotRecord::MAIN ),
156 'content_size' => 'slots.rev_len',
157 'content_sha1' => 'slots.rev_sha1',
158 'content_address' =>
159 $db->buildConcat( [ $db->addQuotes( 'tt:' ), 'slots.rev_text_id' ] ),
160 'model_name' => 'NULL',
161 ]
162 ),
163 'joins' => [],
164 ]
165 ];
166 }
167
169 foreach ( parent::provideNewMutableRevisionFromArray() as $case ) {
170 yield $case;
171 }
172
173 yield 'Basic array, with page & id' => [
174 [
175 'id' => 2,
176 'page' => 1,
177 'text_id' => 2,
178 'timestamp' => '20171017114835',
179 'user_text' => '111.0.1.2',
180 'user' => 0,
181 'minor_edit' => false,
182 'deleted' => 0,
183 'len' => 46,
184 'parent_id' => 1,
185 'sha1' => 'rdqbbzs3pkhihgbs8qf2q9jsvheag5z',
186 'comment' => 'Goat Comment!',
187 ]
188 ];
189 }
190
191}
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Database $db
Primary database.
Tests RevisionStore against the pre-MCR, pre-ContentHandler DB schema.
revisionToRow(Revision $rev, $options=[ 'page', 'user', 'comment'])
addQuotes( $s)
Adds quotes and backslashes.
buildConcat( $stringList)
Build a concatenation list to feed into a SQL query.
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
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
Definition hooks.txt:181
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
Definition hooks.txt:1999
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
Definition hooks.txt:1779
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
Definition injection.txt:37
trait PreMcrSchemaOverride
Trait providing schema overrides that allow tests to run against the pre-MCR database schema.
const DB_REPLICA
Definition defines.php:25