1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace WikibaseQuality\ConstraintReport; |
4
|
|
|
|
5
|
|
|
use Config; |
6
|
|
|
use DataValues\DataValueFactory; |
7
|
|
|
use IBufferingStatsdDataFactory; |
8
|
|
|
use MediaWiki\MediaWikiServices; |
9
|
|
|
use TitleParser; |
10
|
|
|
use Wikibase\DataModel\Entity\EntityIdParser; |
11
|
|
|
use Wikibase\DataModel\Services\Lookup\EntityLookup; |
12
|
|
|
use Wikibase\DataModel\Services\Lookup\PropertyDataTypeLookup; |
13
|
|
|
use Wikibase\Lib\Store\EntityNamespaceLookup; |
14
|
|
|
use Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataAccessor; |
15
|
|
|
use Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataLookup; |
16
|
|
|
use Wikibase\Lib\Units\UnitConverter; |
17
|
|
|
use Wikibase\Rdf\RdfVocabulary; |
18
|
|
|
use Wikibase\Repo\WikibaseRepo; |
19
|
|
|
use WikibaseQuality\ConstraintReport\Api\CachingResultsSource; |
20
|
|
|
use WikibaseQuality\ConstraintReport\Api\CheckingResultsSource; |
21
|
|
|
use WikibaseQuality\ConstraintReport\Api\ResultsCache; |
22
|
|
|
use WikibaseQuality\ConstraintReport\Api\ResultsSource; |
23
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Checker\CitationNeededChecker; |
24
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Checker\EntityTypeChecker; |
25
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Checker\IntegerChecker; |
26
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Checker\NoBoundsChecker; |
27
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Checker\AllowedUnitsChecker; |
28
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Checker\NoneOfChecker; |
29
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Checker\ReferenceChecker; |
30
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Checker\SingleBestValueChecker; |
31
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\DelegatingConstraintChecker; |
32
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Helper\ConstraintParameterParser; |
33
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Checker\CommonsLinkChecker; |
34
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Checker\FormatChecker; |
35
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Checker\OneOfChecker; |
36
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Checker\QualifierChecker; |
37
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Checker\RangeChecker; |
38
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Checker\TypeChecker; |
39
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Checker\ConflictsWithChecker; |
40
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Checker\QualifiersChecker; |
41
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Checker\TargetRequiredClaimChecker; |
42
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Checker\ItemChecker; |
43
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Checker\MandatoryQualifiersChecker; |
44
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Checker\ValueTypeChecker; |
45
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Checker\SymmetricChecker; |
46
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Checker\InverseChecker; |
47
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Checker\DiffWithinRangeChecker; |
48
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Checker\SingleValueChecker; |
49
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Checker\MultiValueChecker; |
50
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Checker\UniqueValueChecker; |
51
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Checker\ValueOnlyChecker; |
52
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\ConstraintChecker; |
53
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Helper\ConnectionCheckerHelper; |
54
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Helper\RangeCheckerHelper; |
55
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Helper\SparqlHelper; |
56
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Helper\TypeCheckerHelper; |
57
|
|
|
use Wikibase\DataModel\Services\Statement\StatementGuidParser; |
58
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Message\ViolationMessageDeserializer; |
59
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Message\ViolationMessageSerializer; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Factory for {@link DelegatingConstraintChecker} |
63
|
|
|
* and {@link ConstraintRepository}. |
64
|
|
|
* |
65
|
|
|
* @license GPL-2.0-or-later |
66
|
|
|
*/ |
67
|
|
|
class ConstraintReportFactory { |
68
|
|
|
|
69
|
|
|
// services created by this factory |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @var DelegatingConstraintChecker|null |
73
|
|
|
*/ |
74
|
|
|
private $delegatingConstraintChecker; |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @var ConstraintChecker[]|null |
78
|
|
|
*/ |
79
|
|
|
private $constraintCheckerMap; |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @var WikiPageEntityMetaDataAccessor|null |
83
|
|
|
*/ |
84
|
|
|
private $wikiPageEntityMetaDataAccessor; |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @var ResultsSource|null |
88
|
|
|
*/ |
89
|
|
|
private $resultsSource; |
90
|
|
|
|
91
|
|
|
// services used by this factory |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* @var EntityLookup |
95
|
|
|
*/ |
96
|
|
|
private $lookup; |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @var PropertyDataTypeLookup |
100
|
|
|
*/ |
101
|
|
|
private $propertyDataTypeLookup; |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* @var StatementGuidParser |
105
|
|
|
*/ |
106
|
|
|
private $statementGuidParser; |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @var Config |
110
|
|
|
*/ |
111
|
|
|
private $config; |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* @var ConstraintParameterParser |
115
|
|
|
*/ |
116
|
|
|
private $constraintParameterParser; |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* @var ViolationMessageSerializer |
120
|
|
|
*/ |
121
|
|
|
private $violationMessageSerializer; |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* @var ViolationMessageDeserializer |
125
|
|
|
*/ |
126
|
|
|
private $violationMessageDeserializer; |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* @var RdfVocabulary |
130
|
|
|
*/ |
131
|
|
|
private $rdfVocabulary; |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* @var EntityIdParser |
135
|
|
|
*/ |
136
|
|
|
private $entityIdParser; |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* @var TitleParser |
140
|
|
|
*/ |
141
|
|
|
private $titleParser; |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* @var UnitConverter|null |
145
|
|
|
*/ |
146
|
|
|
private $unitConverter; |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* @var DataValueFactory |
150
|
|
|
*/ |
151
|
|
|
private $dataValueFactory; |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* @var EntityNamespaceLookup |
155
|
|
|
*/ |
156
|
|
|
private $entityNamespaceLookup; |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* @var IBufferingStatsdDataFactory |
160
|
|
|
*/ |
161
|
|
|
private $dataFactory; |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* Returns the default instance. |
165
|
|
|
* IMPORTANT: Use only when it is not feasible to inject an instance properly. |
166
|
|
|
* |
167
|
|
|
* @return self |
168
|
|
|
*/ |
169
|
|
|
public static function getDefaultInstance() { |
170
|
|
|
static $instance = null; |
171
|
|
|
|
172
|
|
|
if ( $instance === null ) { |
173
|
|
|
$wikibaseRepo = WikibaseRepo::getDefaultInstance(); |
174
|
|
|
$config = MediaWikiServices::getInstance()->getMainConfig(); |
175
|
|
|
$titleParser = MediaWikiServices::getInstance()->getTitleParser(); |
176
|
|
|
$violationMessageDeserializer = new ViolationMessageDeserializer( |
177
|
|
|
$wikibaseRepo->getEntityIdParser(), |
178
|
|
|
$wikibaseRepo->getDataValueFactory() |
179
|
|
|
); |
180
|
|
|
$instance = new self( |
181
|
|
|
$wikibaseRepo->getEntityLookup(), |
182
|
|
|
$wikibaseRepo->getPropertyDataTypeLookup(), |
183
|
|
|
$wikibaseRepo->getStatementGuidParser(), |
184
|
|
|
$config, |
185
|
|
|
new ConstraintParameterParser( |
186
|
|
|
$config, |
187
|
|
|
$wikibaseRepo->getBaseDataModelDeserializerFactory(), |
188
|
|
|
$wikibaseRepo->getConceptBaseUris() |
189
|
|
|
), |
190
|
|
|
new ViolationMessageSerializer(), |
191
|
|
|
$violationMessageDeserializer, |
192
|
|
|
$wikibaseRepo->getRdfVocabulary(), |
193
|
|
|
$wikibaseRepo->getEntityIdParser(), |
194
|
|
|
$titleParser, |
195
|
|
|
$wikibaseRepo->getUnitConverter(), |
196
|
|
|
$wikibaseRepo->getDataValueFactory(), |
197
|
|
|
$wikibaseRepo->getEntityNamespaceLookup(), |
198
|
|
|
MediaWikiServices::getInstance()->getStatsdDataFactory() |
199
|
|
|
); |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
return $instance; |
203
|
|
|
} |
204
|
|
|
|
205
|
|
|
public function __construct( |
206
|
|
|
EntityLookup $lookup, |
207
|
|
|
PropertyDataTypeLookup $propertyDataTypeLookup, |
208
|
|
|
StatementGuidParser $statementGuidParser, |
209
|
|
|
Config $config, |
210
|
|
|
ConstraintParameterParser $constraintParameterParser, |
211
|
|
|
ViolationMessageSerializer $violationMessageSerializer, |
212
|
|
|
ViolationMessageDeserializer $violationMessageDeserializer, |
213
|
|
|
RdfVocabulary $rdfVocabulary, |
214
|
|
|
EntityIdParser $entityIdParser, |
215
|
|
|
TitleParser $titleParser, |
216
|
|
|
UnitConverter $unitConverter = null, |
217
|
|
|
DataValueFactory $dataValueFactory, |
218
|
|
|
EntityNamespaceLookup $entityNamespaceLookup, |
219
|
|
|
IBufferingStatsdDataFactory $dataFactory |
220
|
|
|
) { |
221
|
|
|
$this->lookup = $lookup; |
222
|
|
|
$this->propertyDataTypeLookup = $propertyDataTypeLookup; |
223
|
|
|
$this->statementGuidParser = $statementGuidParser; |
224
|
|
|
$this->config = $config; |
225
|
|
|
$this->constraintParameterParser = $constraintParameterParser; |
226
|
|
|
$this->violationMessageSerializer = $violationMessageSerializer; |
227
|
|
|
$this->violationMessageDeserializer = $violationMessageDeserializer; |
228
|
|
|
$this->rdfVocabulary = $rdfVocabulary; |
229
|
|
|
$this->entityIdParser = $entityIdParser; |
230
|
|
|
$this->titleParser = $titleParser; |
231
|
|
|
$this->unitConverter = $unitConverter; |
232
|
|
|
$this->dataValueFactory = $dataValueFactory; |
233
|
|
|
$this->entityNamespaceLookup = $entityNamespaceLookup; |
234
|
|
|
$this->dataFactory = $dataFactory; |
235
|
|
|
} |
236
|
|
|
|
237
|
|
|
/** |
238
|
|
|
* @return DelegatingConstraintChecker |
239
|
|
|
*/ |
240
|
|
|
public function getConstraintChecker() { |
241
|
|
|
if ( $this->delegatingConstraintChecker === null ) { |
242
|
|
|
$this->delegatingConstraintChecker = new DelegatingConstraintChecker( |
243
|
|
|
$this->lookup, |
244
|
|
|
$this->getConstraintCheckerMap(), |
245
|
|
|
ConstraintsServices::getConstraintLookup(), |
246
|
|
|
$this->constraintParameterParser, |
247
|
|
|
$this->statementGuidParser, |
248
|
|
|
ConstraintsServices::getLoggingHelper(), |
249
|
|
|
$this->config->get( 'WBQualityConstraintsCheckQualifiers' ), |
250
|
|
|
$this->config->get( 'WBQualityConstraintsCheckReferences' ), |
251
|
|
|
$this->config->get( 'WBQualityConstraintsPropertiesWithViolatingQualifiers' ) |
252
|
|
|
); |
253
|
|
|
} |
254
|
|
|
|
255
|
|
|
return $this->delegatingConstraintChecker; |
256
|
|
|
} |
257
|
|
|
|
258
|
|
|
/** |
259
|
|
|
* @return ConstraintChecker[] |
260
|
|
|
*/ |
261
|
|
|
private function getConstraintCheckerMap() { |
262
|
|
|
if ( $this->constraintCheckerMap === null ) { |
263
|
|
|
$connectionCheckerHelper = new ConnectionCheckerHelper(); |
264
|
|
|
$rangeCheckerHelper = new RangeCheckerHelper( $this->config, $this->unitConverter ); |
265
|
|
|
if ( $this->config->get( 'WBQualityConstraintsSparqlEndpoint' ) !== '' ) { |
266
|
|
|
$sparqlHelper = new SparqlHelper( |
267
|
|
|
$this->config, |
268
|
|
|
$this->rdfVocabulary, |
269
|
|
|
$this->entityIdParser, |
270
|
|
|
$this->propertyDataTypeLookup, |
271
|
|
|
MediaWikiServices::getInstance()->getMainWANObjectCache(), |
272
|
|
|
$this->violationMessageSerializer, |
273
|
|
|
$this->violationMessageDeserializer, |
274
|
|
|
$this->dataFactory |
275
|
|
|
); |
276
|
|
|
} else { |
277
|
|
|
$sparqlHelper = null; |
278
|
|
|
} |
279
|
|
|
$typeCheckerHelper = new TypeCheckerHelper( |
280
|
|
|
$this->lookup, |
281
|
|
|
$this->config, |
282
|
|
|
$sparqlHelper, |
283
|
|
|
$this->dataFactory |
284
|
|
|
); |
285
|
|
|
|
286
|
|
|
$this->constraintCheckerMap = [ |
287
|
|
|
$this->config->get( 'WBQualityConstraintsConflictsWithConstraintId' ) |
288
|
|
|
=> new ConflictsWithChecker( |
289
|
|
|
$this->lookup, |
290
|
|
|
$this->constraintParameterParser, |
291
|
|
|
$connectionCheckerHelper |
292
|
|
|
), |
293
|
|
|
$this->config->get( 'WBQualityConstraintsItemRequiresClaimConstraintId' ) |
294
|
|
|
=> new ItemChecker( |
295
|
|
|
$this->lookup, |
296
|
|
|
$this->constraintParameterParser, |
297
|
|
|
$connectionCheckerHelper |
298
|
|
|
), |
299
|
|
|
$this->config->get( 'WBQualityConstraintsValueRequiresClaimConstraintId' ) |
300
|
|
|
=> new TargetRequiredClaimChecker( |
301
|
|
|
$this->lookup, |
302
|
|
|
$this->constraintParameterParser, |
303
|
|
|
$connectionCheckerHelper |
304
|
|
|
), |
305
|
|
|
$this->config->get( 'WBQualityConstraintsSymmetricConstraintId' ) |
306
|
|
|
=> new SymmetricChecker( |
307
|
|
|
$this->lookup, |
308
|
|
|
$connectionCheckerHelper |
309
|
|
|
), |
310
|
|
|
$this->config->get( 'WBQualityConstraintsInverseConstraintId' ) |
311
|
|
|
=> new InverseChecker( |
312
|
|
|
$this->lookup, |
313
|
|
|
$this->constraintParameterParser, |
314
|
|
|
$connectionCheckerHelper |
315
|
|
|
), |
316
|
|
|
$this->config->get( 'WBQualityConstraintsUsedAsQualifierConstraintId' ) |
317
|
|
|
=> new QualifierChecker(), |
318
|
|
|
$this->config->get( 'WBQualityConstraintsAllowedQualifiersConstraintId' ) |
319
|
|
|
=> new QualifiersChecker( |
320
|
|
|
$this->constraintParameterParser |
321
|
|
|
), |
322
|
|
|
$this->config->get( 'WBQualityConstraintsMandatoryQualifierConstraintId' ) |
323
|
|
|
=> new MandatoryQualifiersChecker( |
324
|
|
|
$this->constraintParameterParser |
325
|
|
|
), |
326
|
|
|
$this->config->get( 'WBQualityConstraintsRangeConstraintId' ) |
327
|
|
|
=> new RangeChecker( |
328
|
|
|
$this->propertyDataTypeLookup, |
329
|
|
|
$this->constraintParameterParser, |
330
|
|
|
$rangeCheckerHelper |
331
|
|
|
), |
332
|
|
|
$this->config->get( 'WBQualityConstraintsDifferenceWithinRangeConstraintId' ) |
333
|
|
|
=> new DiffWithinRangeChecker( |
334
|
|
|
$this->constraintParameterParser, |
335
|
|
|
$rangeCheckerHelper, |
336
|
|
|
$this->config |
337
|
|
|
), |
338
|
|
|
$this->config->get( 'WBQualityConstraintsTypeConstraintId' ) |
339
|
|
|
=> new TypeChecker( |
340
|
|
|
$this->lookup, |
341
|
|
|
$this->constraintParameterParser, |
342
|
|
|
$typeCheckerHelper, |
343
|
|
|
$this->config |
344
|
|
|
), |
345
|
|
|
$this->config->get( 'WBQualityConstraintsValueTypeConstraintId' ) |
346
|
|
|
=> new ValueTypeChecker( |
347
|
|
|
$this->lookup, |
348
|
|
|
$this->constraintParameterParser, |
349
|
|
|
$typeCheckerHelper, |
350
|
|
|
$this->config |
351
|
|
|
), |
352
|
|
|
$this->config->get( 'WBQualityConstraintsSingleValueConstraintId' ) |
353
|
|
|
=> new SingleValueChecker( $this->constraintParameterParser ), |
354
|
|
|
$this->config->get( 'WBQualityConstraintsMultiValueConstraintId' ) |
355
|
|
|
=> new MultiValueChecker( $this->constraintParameterParser ), |
356
|
|
|
$this->config->get( 'WBQualityConstraintsDistinctValuesConstraintId' ) |
357
|
|
|
=> new UniqueValueChecker( |
358
|
|
|
$sparqlHelper |
359
|
|
|
), |
360
|
|
|
$this->config->get( 'WBQualityConstraintsFormatConstraintId' ) |
361
|
|
|
=> new FormatChecker( |
362
|
|
|
$this->constraintParameterParser, |
363
|
|
|
$this->config, |
364
|
|
|
$sparqlHelper |
365
|
|
|
), |
366
|
|
|
$this->config->get( 'WBQualityConstraintsCommonsLinkConstraintId' ) |
367
|
|
|
=> new CommonsLinkChecker( |
368
|
|
|
$this->constraintParameterParser, |
369
|
|
|
$this->titleParser |
370
|
|
|
), |
371
|
|
|
$this->config->get( 'WBQualityConstraintsOneOfConstraintId' ) |
372
|
|
|
=> new OneOfChecker( |
373
|
|
|
$this->constraintParameterParser |
374
|
|
|
), |
375
|
|
|
$this->config->get( 'WBQualityConstraintsUsedForValuesOnlyConstraintId' ) |
376
|
|
|
=> new ValueOnlyChecker(), |
377
|
|
|
$this->config->get( 'WBQualityConstraintsUsedAsReferenceConstraintId' ) |
378
|
|
|
=> new ReferenceChecker(), |
379
|
|
|
$this->config->get( 'WBQualityConstraintsNoBoundsConstraintId' ) |
380
|
|
|
=> new NoBoundsChecker(), |
381
|
|
|
$this->config->get( 'WBQualityConstraintsAllowedUnitsConstraintId' ) |
382
|
|
|
=> new AllowedUnitsChecker( |
383
|
|
|
$this->constraintParameterParser, |
384
|
|
|
$this->unitConverter |
385
|
|
|
), |
386
|
|
|
$this->config->get( 'WBQualityConstraintsSingleBestValueConstraintId' ) |
387
|
|
|
=> new SingleBestValueChecker( $this->constraintParameterParser ), |
388
|
|
|
$this->config->get( 'WBQualityConstraintsAllowedEntityTypesConstraintId' ) |
389
|
|
|
=> new EntityTypeChecker( |
390
|
|
|
$this->constraintParameterParser |
391
|
|
|
), |
392
|
|
|
$this->config->get( 'WBQualityConstraintsNoneOfConstraintId' ) |
393
|
|
|
=> new NoneOfChecker( |
394
|
|
|
$this->constraintParameterParser |
395
|
|
|
), |
396
|
|
|
$this->config->get( 'WBQualityConstraintsIntegerConstraintId' ) |
397
|
|
|
=> new IntegerChecker(), |
398
|
|
|
$this->config->get( 'WBQualityConstraintsCitationNeededConstraintId' ) |
399
|
|
|
=> new CitationNeededChecker(), |
400
|
|
|
]; |
401
|
|
|
} |
402
|
|
|
|
403
|
|
|
return $this->constraintCheckerMap; |
404
|
|
|
} |
405
|
|
|
|
406
|
|
|
/** |
407
|
|
|
* @return WikiPageEntityMetaDataAccessor |
408
|
|
|
*/ |
409
|
|
|
public function getWikiPageEntityMetaDataAccessor() { |
410
|
|
|
if ( $this->wikiPageEntityMetaDataAccessor === null ) { |
411
|
|
|
$this->wikiPageEntityMetaDataAccessor = new WikiPageEntityMetaDataLookup( |
|
|
|
|
412
|
|
|
$this->entityNamespaceLookup |
413
|
|
|
); |
414
|
|
|
} |
415
|
|
|
|
416
|
|
|
return $this->wikiPageEntityMetaDataAccessor; |
|
|
|
|
417
|
|
|
} |
418
|
|
|
|
419
|
|
|
/** |
420
|
|
|
* @return ResultsSource |
421
|
|
|
*/ |
422
|
|
|
public function getResultsSource() { |
423
|
|
|
if ( $this->resultsSource === null ) { |
424
|
|
|
$this->resultsSource = new CheckingResultsSource( |
425
|
|
|
$this->getConstraintChecker() |
426
|
|
|
); |
427
|
|
|
|
428
|
|
|
if ( $this->config->get( 'WBQualityConstraintsCacheCheckConstraintsResults' ) ) { |
429
|
|
|
$this->resultsSource = new CachingResultsSource( |
430
|
|
|
$this->resultsSource, |
431
|
|
|
ResultsCache::getDefaultInstance(), |
432
|
|
|
ConstraintsServices::getCheckResultSerializer(), |
433
|
|
|
ConstraintsServices::getCheckResultDeserializer(), |
434
|
|
|
$this->getWikiPageEntityMetaDataAccessor(), |
435
|
|
|
$this->entityIdParser, |
436
|
|
|
$this->config->get( 'WBQualityConstraintsCacheCheckConstraintsTTLSeconds' ), |
437
|
|
|
$this->getPossiblyStaleConstraintTypes(), |
438
|
|
|
$this->config->get( 'WBQualityConstraintsCacheCheckConstraintsMaximumRevisionIds' ), |
439
|
|
|
ConstraintsServices::getLoggingHelper() |
440
|
|
|
); |
441
|
|
|
} |
442
|
|
|
} |
443
|
|
|
|
444
|
|
|
return $this->resultsSource; |
445
|
|
|
} |
446
|
|
|
|
447
|
|
|
/** |
448
|
|
|
* @return string[] |
449
|
|
|
*/ |
450
|
|
|
public function getPossiblyStaleConstraintTypes() { |
451
|
|
|
return [ |
452
|
|
|
$this->config->get( 'WBQualityConstraintsCommonsLinkConstraintId' ), |
453
|
|
|
$this->config->get( 'WBQualityConstraintsTypeConstraintId' ), |
454
|
|
|
$this->config->get( 'WBQualityConstraintsValueTypeConstraintId' ), |
455
|
|
|
$this->config->get( 'WBQualityConstraintsDistinctValuesConstraintId' ), |
456
|
|
|
]; |
457
|
|
|
} |
458
|
|
|
|
459
|
|
|
} |
460
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..