Go to the documentation of this file.
14 if ( isset( $modifiedQuery[
'fields'][
'ts_tags'] ) ) {
15 $modifiedQuery[
'fields'][
'ts_tags'] = call_user_func_array(
17 $modifiedQuery[
'fields'][
'ts_tags']
20 if ( isset( $modifiedQuery[
'exception'] ) ) {
21 $this->setExpectedException( $modifiedQuery[
'exception'] );
27 $origQuery[
'join_conds'],
28 $origQuery[
'options'],
31 if ( !isset( $modifiedQuery[
'exception'] ) ) {
45 'recentchanges' => [
',',
'change_tag',
'ct_tag',
'ct_rc_id=rc_id' ],
46 'logging' => [
',',
'change_tag',
'ct_tag',
'ct_log_id=log_id' ],
47 'revision' => [
',',
'change_tag',
'ct_tag',
'ct_rev_id=rev_id' ],
48 'archive' => [
',',
'change_tag',
'ct_tag',
'ct_rev_id=ar_rev_id' ],
52 'simple recentchanges query' => [
54 'tables' => [
'recentchanges' ],
55 'fields' => [
'rc_id',
'rc_timestamp' ],
56 'conds' => [
"rc_timestamp > '20170714183203'" ],
58 'options' => [
'ORDER BY' =>
'rc_timestamp DESC' ],
63 'tables' => [
'recentchanges' ],
64 'fields' => [
'rc_id',
'rc_timestamp',
'ts_tags' => $groupConcats[
'recentchanges'] ],
65 'conds' => [
"rc_timestamp > '20170714183203'" ],
67 'options' => [
'ORDER BY' =>
'rc_timestamp DESC' ],
70 'simple query with strings' => [
72 'tables' =>
'recentchanges',
74 'conds' =>
"rc_timestamp > '20170714183203'",
76 'options' =>
'ORDER BY rc_timestamp DESC',
81 'tables' => [
'recentchanges' ],
82 'fields' => [
'rc_id',
'ts_tags' => $groupConcats[
'recentchanges'] ],
83 'conds' => [
"rc_timestamp > '20170714183203'" ],
85 'options' => [
'ORDER BY rc_timestamp DESC' ],
88 'recentchanges query with single tag filter' => [
90 'tables' => [
'recentchanges' ],
91 'fields' => [
'rc_id',
'rc_timestamp' ],
92 'conds' => [
"rc_timestamp > '20170714183203'" ],
94 'options' => [
'ORDER BY' =>
'rc_timestamp DESC' ],
99 'tables' => [
'recentchanges',
'change_tag' ],
100 'fields' => [
'rc_id',
'rc_timestamp',
'ts_tags' => $groupConcats[
'recentchanges'] ],
101 'conds' => [
"rc_timestamp > '20170714183203'",
'ct_tag' =>
'foo' ],
102 'join_conds' => [
'change_tag' => [
'INNER JOIN',
'ct_rc_id=rc_id' ] ],
103 'options' => [
'ORDER BY' =>
'rc_timestamp DESC' ],
106 'logging query with single tag filter and strings' => [
108 'tables' =>
'logging',
109 'fields' =>
'log_id',
110 'conds' =>
"log_timestamp > '20170714183203'",
112 'options' =>
'ORDER BY log_timestamp DESC',
117 'tables' => [
'logging',
'change_tag' ],
118 'fields' => [
'log_id',
'ts_tags' => $groupConcats[
'logging'] ],
119 'conds' => [
"log_timestamp > '20170714183203'",
'ct_tag' =>
'foo' ],
120 'join_conds' => [
'change_tag' => [
'INNER JOIN',
'ct_log_id=log_id' ] ],
121 'options' => [
'ORDER BY log_timestamp DESC' ],
124 'revision query with single tag filter' => [
126 'tables' => [
'revision' ],
127 'fields' => [
'rev_id',
'rev_timestamp' ],
128 'conds' => [
"rev_timestamp > '20170714183203'" ],
130 'options' => [
'ORDER BY' =>
'rev_timestamp DESC' ],
135 'tables' => [
'revision',
'change_tag' ],
136 'fields' => [
'rev_id',
'rev_timestamp',
'ts_tags' => $groupConcats[
'revision'] ],
137 'conds' => [
"rev_timestamp > '20170714183203'",
'ct_tag' =>
'foo' ],
138 'join_conds' => [
'change_tag' => [
'INNER JOIN',
'ct_rev_id=rev_id' ] ],
139 'options' => [
'ORDER BY' =>
'rev_timestamp DESC' ],
142 'archive query with single tag filter' => [
144 'tables' => [
'archive' ],
145 'fields' => [
'ar_id',
'ar_timestamp' ],
146 'conds' => [
"ar_timestamp > '20170714183203'" ],
148 'options' => [
'ORDER BY' =>
'ar_timestamp DESC' ],
153 'tables' => [
'archive',
'change_tag' ],
154 'fields' => [
'ar_id',
'ar_timestamp',
'ts_tags' => $groupConcats[
'archive'] ],
155 'conds' => [
"ar_timestamp > '20170714183203'",
'ct_tag' =>
'foo' ],
156 'join_conds' => [
'change_tag' => [
'INNER JOIN',
'ct_rev_id=ar_rev_id' ] ],
157 'options' => [
'ORDER BY' =>
'ar_timestamp DESC' ],
160 'unsupported table name throws exception (even without tag filter)' => [
162 'tables' => [
'foobar' ],
163 'fields' => [
'fb_id',
'fb_timestamp' ],
164 'conds' => [
"fb_timestamp > '20170714183203'" ],
166 'options' => [
'ORDER BY' =>
'fb_timestamp DESC' ],
172 'tag filter ignored when tag filtering is disabled' => [
174 'tables' => [
'archive' ],
175 'fields' => [
'ar_id',
'ar_timestamp' ],
176 'conds' => [
"ar_timestamp > '20170714183203'" ],
178 'options' => [
'ORDER BY' =>
'ar_timestamp DESC' ],
183 'tables' => [
'archive' ],
184 'fields' => [
'ar_id',
'ar_timestamp',
'ts_tags' => $groupConcats[
'archive'] ],
185 'conds' => [
"ar_timestamp > '20170714183203'" ],
187 'options' => [
'ORDER BY' =>
'ar_timestamp DESC' ],
190 'recentchanges query with multiple tag filter' => [
192 'tables' => [
'recentchanges' ],
193 'fields' => [
'rc_id',
'rc_timestamp' ],
194 'conds' => [
"rc_timestamp > '20170714183203'" ],
196 'options' => [
'ORDER BY' =>
'rc_timestamp DESC' ],
201 'tables' => [
'recentchanges',
'change_tag' ],
202 'fields' => [
'rc_id',
'rc_timestamp',
'ts_tags' => $groupConcats[
'recentchanges'] ],
203 'conds' => [
"rc_timestamp > '20170714183203'",
'ct_tag' => [
'foo',
'bar' ] ],
204 'join_conds' => [
'change_tag' => [
'INNER JOIN',
'ct_rc_id=rc_id' ] ],
205 'options' => [
'ORDER BY' =>
'rc_timestamp DESC',
'DISTINCT' ],
208 'recentchanges query with multiple tag filter that already has DISTINCT' => [
210 'tables' => [
'recentchanges' ],
211 'fields' => [
'rc_id',
'rc_timestamp' ],
212 'conds' => [
"rc_timestamp > '20170714183203'" ],
214 'options' => [
'DISTINCT',
'ORDER BY' =>
'rc_timestamp DESC' ],
219 'tables' => [
'recentchanges',
'change_tag' ],
220 'fields' => [
'rc_id',
'rc_timestamp',
'ts_tags' => $groupConcats[
'recentchanges'] ],
221 'conds' => [
"rc_timestamp > '20170714183203'",
'ct_tag' => [
'foo',
'bar' ] ],
222 'join_conds' => [
'change_tag' => [
'INNER JOIN',
'ct_rc_id=rc_id' ] ],
223 'options' => [
'DISTINCT',
'ORDER BY' =>
'rc_timestamp DESC' ],
226 'recentchanges query with multiple tag filter with strings' => [
228 'tables' =>
'recentchanges',
230 'conds' =>
"rc_timestamp > '20170714183203'",
232 'options' =>
'ORDER BY rc_timestamp DESC',
237 'tables' => [
'recentchanges',
'change_tag' ],
238 'fields' => [
'rc_id',
'ts_tags' => $groupConcats[
'recentchanges'] ],
239 'conds' => [
"rc_timestamp > '20170714183203'",
'ct_tag' => [
'foo',
'bar' ] ],
240 'join_conds' => [
'change_tag' => [
'INNER JOIN',
'ct_rc_id=rc_id' ] ],
241 'options' => [
'ORDER BY rc_timestamp DESC',
'DISTINCT' ],
251 'mw-contentModelChange' =>
true,
252 'mw-redirect' =>
true,
253 'mw-rollback' =>
true,
266 'mw-contentmodelchanged' =>
true,
267 'mw-replace' =>
true,
268 'mw-new-redirects' =>
true,
269 'mw-changed-redirect-target' =>
true,
270 'mw-rolback' =>
true,
271 'mw-blanking' =>
false
275 'mw-changed-redirect-target'
307 $this->assertEquals( $expected, $actual );
processing should stop and the error should be shown to the user * false
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
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
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
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class