@@ -36,189 +36,189 @@ |
||
36 | 36 | use WikibaseQuality\ConstraintReport\ConstraintCheck\Checker\ValueTypeChecker; |
37 | 37 | |
38 | 38 | return [ |
39 | - ConstraintCheckerServices::CONFLICTS_WITH_CHECKER => function ( MediaWikiServices $services ) { |
|
39 | + ConstraintCheckerServices::CONFLICTS_WITH_CHECKER => function(MediaWikiServices $services) { |
|
40 | 40 | return new ConflictsWithChecker( |
41 | - ConstraintsServices::getConstraintParameterParser( $services ), |
|
42 | - ConstraintsServices::getConnectionCheckerHelper( $services ) |
|
41 | + ConstraintsServices::getConstraintParameterParser($services), |
|
42 | + ConstraintsServices::getConnectionCheckerHelper($services) |
|
43 | 43 | ); |
44 | 44 | }, |
45 | 45 | |
46 | - ConstraintCheckerServices::ITEM_CHECKER => function ( MediaWikiServices $services ) { |
|
46 | + ConstraintCheckerServices::ITEM_CHECKER => function(MediaWikiServices $services) { |
|
47 | 47 | return new ItemChecker( |
48 | - ConstraintsServices::getConstraintParameterParser( $services ), |
|
49 | - ConstraintsServices::getConnectionCheckerHelper( $services ) |
|
48 | + ConstraintsServices::getConstraintParameterParser($services), |
|
49 | + ConstraintsServices::getConnectionCheckerHelper($services) |
|
50 | 50 | ); |
51 | 51 | }, |
52 | 52 | |
53 | - ConstraintCheckerServices::TARGET_REQUIRED_CLAIM_CHECKER => function ( MediaWikiServices $services ) { |
|
53 | + ConstraintCheckerServices::TARGET_REQUIRED_CLAIM_CHECKER => function(MediaWikiServices $services) { |
|
54 | 54 | return new TargetRequiredClaimChecker( |
55 | - WikibaseServices::getEntityLookup( $services ), |
|
56 | - ConstraintsServices::getConstraintParameterParser( $services ), |
|
57 | - ConstraintsServices::getConnectionCheckerHelper( $services ) |
|
55 | + WikibaseServices::getEntityLookup($services), |
|
56 | + ConstraintsServices::getConstraintParameterParser($services), |
|
57 | + ConstraintsServices::getConnectionCheckerHelper($services) |
|
58 | 58 | ); |
59 | 59 | }, |
60 | 60 | |
61 | - ConstraintCheckerServices::SYMMETRIC_CHECKER => function ( MediaWikiServices $services ) { |
|
61 | + ConstraintCheckerServices::SYMMETRIC_CHECKER => function(MediaWikiServices $services) { |
|
62 | 62 | return new SymmetricChecker( |
63 | - WikibaseServices::getEntityLookupWithoutCache( $services ), |
|
64 | - ConstraintsServices::getConnectionCheckerHelper( $services ) |
|
63 | + WikibaseServices::getEntityLookupWithoutCache($services), |
|
64 | + ConstraintsServices::getConnectionCheckerHelper($services) |
|
65 | 65 | ); |
66 | 66 | }, |
67 | 67 | |
68 | - ConstraintCheckerServices::INVERSE_CHECKER => function ( MediaWikiServices $services ) { |
|
68 | + ConstraintCheckerServices::INVERSE_CHECKER => function(MediaWikiServices $services) { |
|
69 | 69 | return new InverseChecker( |
70 | - WikibaseServices::getEntityLookup( $services ), |
|
71 | - ConstraintsServices::getConstraintParameterParser( $services ), |
|
72 | - ConstraintsServices::getConnectionCheckerHelper( $services ) |
|
70 | + WikibaseServices::getEntityLookup($services), |
|
71 | + ConstraintsServices::getConstraintParameterParser($services), |
|
72 | + ConstraintsServices::getConnectionCheckerHelper($services) |
|
73 | 73 | ); |
74 | 74 | }, |
75 | 75 | |
76 | - ConstraintCheckerServices::QUALIFIER_CHECKER => function ( MediaWikiServices $services ) { |
|
76 | + ConstraintCheckerServices::QUALIFIER_CHECKER => function(MediaWikiServices $services) { |
|
77 | 77 | return new QualifierChecker(); |
78 | 78 | }, |
79 | 79 | |
80 | - ConstraintCheckerServices::QUALIFIERS_CHECKER => function ( MediaWikiServices $services ) { |
|
80 | + ConstraintCheckerServices::QUALIFIERS_CHECKER => function(MediaWikiServices $services) { |
|
81 | 81 | return new QualifiersChecker( |
82 | - ConstraintsServices::getConstraintParameterParser( $services ) |
|
82 | + ConstraintsServices::getConstraintParameterParser($services) |
|
83 | 83 | ); |
84 | 84 | }, |
85 | 85 | |
86 | - ConstraintCheckerServices::MANDATORY_QUALIFIERS_CHECKER => function ( MediaWikiServices $services ) { |
|
86 | + ConstraintCheckerServices::MANDATORY_QUALIFIERS_CHECKER => function(MediaWikiServices $services) { |
|
87 | 87 | return new MandatoryQualifiersChecker( |
88 | - ConstraintsServices::getConstraintParameterParser( $services ) |
|
88 | + ConstraintsServices::getConstraintParameterParser($services) |
|
89 | 89 | ); |
90 | 90 | }, |
91 | 91 | |
92 | - ConstraintCheckerServices::RANGE_CHECKER => function ( MediaWikiServices $services ) { |
|
92 | + ConstraintCheckerServices::RANGE_CHECKER => function(MediaWikiServices $services) { |
|
93 | 93 | return new RangeChecker( |
94 | - WikibaseServices::getPropertyDataTypeLookup( $services ), |
|
95 | - ConstraintsServices::getConstraintParameterParser( $services ), |
|
96 | - ConstraintsServices::getRangeCheckerHelper( $services ) |
|
94 | + WikibaseServices::getPropertyDataTypeLookup($services), |
|
95 | + ConstraintsServices::getConstraintParameterParser($services), |
|
96 | + ConstraintsServices::getRangeCheckerHelper($services) |
|
97 | 97 | ); |
98 | 98 | }, |
99 | 99 | |
100 | - ConstraintCheckerServices::DIFF_WITHIN_RANGE_CHECKER => function ( MediaWikiServices $services ) { |
|
100 | + ConstraintCheckerServices::DIFF_WITHIN_RANGE_CHECKER => function(MediaWikiServices $services) { |
|
101 | 101 | return new DiffWithinRangeChecker( |
102 | - ConstraintsServices::getConstraintParameterParser( $services ), |
|
103 | - ConstraintsServices::getRangeCheckerHelper( $services ), |
|
102 | + ConstraintsServices::getConstraintParameterParser($services), |
|
103 | + ConstraintsServices::getRangeCheckerHelper($services), |
|
104 | 104 | $services->getMainConfig() |
105 | 105 | ); |
106 | 106 | }, |
107 | 107 | |
108 | - ConstraintCheckerServices::TYPE_CHECKER => function ( MediaWikiServices $services ) { |
|
108 | + ConstraintCheckerServices::TYPE_CHECKER => function(MediaWikiServices $services) { |
|
109 | 109 | return new TypeChecker( |
110 | - ConstraintsServices::getConstraintParameterParser( $services ), |
|
111 | - ConstraintsServices::getTypeCheckerHelper( $services ), |
|
110 | + ConstraintsServices::getConstraintParameterParser($services), |
|
111 | + ConstraintsServices::getTypeCheckerHelper($services), |
|
112 | 112 | $services->getMainConfig() |
113 | 113 | ); |
114 | 114 | }, |
115 | 115 | |
116 | - ConstraintCheckerServices::VALUE_TYPE_CHECKER => function ( MediaWikiServices $services ) { |
|
116 | + ConstraintCheckerServices::VALUE_TYPE_CHECKER => function(MediaWikiServices $services) { |
|
117 | 117 | return new ValueTypeChecker( |
118 | - WikibaseServices::getEntityLookup( $services ), |
|
119 | - ConstraintsServices::getConstraintParameterParser( $services ), |
|
120 | - ConstraintsServices::getTypeCheckerHelper( $services ), |
|
118 | + WikibaseServices::getEntityLookup($services), |
|
119 | + ConstraintsServices::getConstraintParameterParser($services), |
|
120 | + ConstraintsServices::getTypeCheckerHelper($services), |
|
121 | 121 | $services->getMainConfig() |
122 | 122 | ); |
123 | 123 | }, |
124 | 124 | |
125 | - ConstraintCheckerServices::SINGLE_VALUE_CHECKER => function ( MediaWikiServices $services ) { |
|
125 | + ConstraintCheckerServices::SINGLE_VALUE_CHECKER => function(MediaWikiServices $services) { |
|
126 | 126 | return new SingleValueChecker( |
127 | - ConstraintsServices::getConstraintParameterParser( $services ) |
|
127 | + ConstraintsServices::getConstraintParameterParser($services) |
|
128 | 128 | ); |
129 | 129 | }, |
130 | 130 | |
131 | - ConstraintCheckerServices::MULTI_VALUE_CHECKER => function ( MediaWikiServices $services ) { |
|
131 | + ConstraintCheckerServices::MULTI_VALUE_CHECKER => function(MediaWikiServices $services) { |
|
132 | 132 | return new MultiValueChecker( |
133 | - ConstraintsServices::getConstraintParameterParser( $services ) |
|
133 | + ConstraintsServices::getConstraintParameterParser($services) |
|
134 | 134 | ); |
135 | 135 | }, |
136 | 136 | |
137 | - ConstraintCheckerServices::UNIQUE_VALUE_CHECKER => function ( MediaWikiServices $services ) { |
|
137 | + ConstraintCheckerServices::UNIQUE_VALUE_CHECKER => function(MediaWikiServices $services) { |
|
138 | 138 | // TODO return a different, dummy implementation if SPARQL is not available |
139 | 139 | return new UniqueValueChecker( |
140 | - ConstraintsServices::getSparqlHelper( $services ) |
|
140 | + ConstraintsServices::getSparqlHelper($services) |
|
141 | 141 | ); |
142 | 142 | }, |
143 | 143 | |
144 | - ConstraintCheckerServices::FORMAT_CHECKER => function ( MediaWikiServices $services ) { |
|
144 | + ConstraintCheckerServices::FORMAT_CHECKER => function(MediaWikiServices $services) { |
|
145 | 145 | // TODO return a different, dummy implementation if SPARQL is not available |
146 | 146 | return new FormatChecker( |
147 | - ConstraintsServices::getConstraintParameterParser( $services ), |
|
147 | + ConstraintsServices::getConstraintParameterParser($services), |
|
148 | 148 | $services->getMainConfig(), |
149 | - ConstraintsServices::getSparqlHelper( $services ) |
|
149 | + ConstraintsServices::getSparqlHelper($services) |
|
150 | 150 | ); |
151 | 151 | }, |
152 | 152 | |
153 | - ConstraintCheckerServices::COMMONS_LINK_CHECKER => function ( MediaWikiServices $services ) { |
|
153 | + ConstraintCheckerServices::COMMONS_LINK_CHECKER => function(MediaWikiServices $services) { |
|
154 | 154 | $pageNameNormalizer = new MediaWikiPageNameNormalizer(); |
155 | 155 | return new CommonsLinkChecker( |
156 | - ConstraintsServices::getConstraintParameterParser( $services ), |
|
156 | + ConstraintsServices::getConstraintParameterParser($services), |
|
157 | 157 | $pageNameNormalizer |
158 | 158 | ); |
159 | 159 | }, |
160 | 160 | |
161 | - ConstraintCheckerServices::ONE_OF_CHECKER => function ( MediaWikiServices $services ) { |
|
161 | + ConstraintCheckerServices::ONE_OF_CHECKER => function(MediaWikiServices $services) { |
|
162 | 162 | return new OneOfChecker( |
163 | - ConstraintsServices::getConstraintParameterParser( $services ) |
|
163 | + ConstraintsServices::getConstraintParameterParser($services) |
|
164 | 164 | ); |
165 | 165 | }, |
166 | 166 | |
167 | - ConstraintCheckerServices::VALUE_ONLY_CHECKER => function ( MediaWikiServices $services ) { |
|
167 | + ConstraintCheckerServices::VALUE_ONLY_CHECKER => function(MediaWikiServices $services) { |
|
168 | 168 | return new ValueOnlyChecker(); |
169 | 169 | }, |
170 | 170 | |
171 | - ConstraintCheckerServices::REFERENCE_CHECKER => function ( MediaWikiServices $services ) { |
|
171 | + ConstraintCheckerServices::REFERENCE_CHECKER => function(MediaWikiServices $services) { |
|
172 | 172 | return new ReferenceChecker(); |
173 | 173 | }, |
174 | 174 | |
175 | - ConstraintCheckerServices::NO_BOUNDS_CHECKER => function ( MediaWikiServices $services ) { |
|
175 | + ConstraintCheckerServices::NO_BOUNDS_CHECKER => function(MediaWikiServices $services) { |
|
176 | 176 | return new NoBoundsChecker(); |
177 | 177 | }, |
178 | 178 | |
179 | - ConstraintCheckerServices::ALLOWED_UNITS_CHECKER => function ( MediaWikiServices $services ) { |
|
179 | + ConstraintCheckerServices::ALLOWED_UNITS_CHECKER => function(MediaWikiServices $services) { |
|
180 | 180 | return new AllowedUnitsChecker( |
181 | - ConstraintsServices::getConstraintParameterParser( $services ), |
|
182 | - WikibaseRepo::getUnitConverter( $services ) |
|
181 | + ConstraintsServices::getConstraintParameterParser($services), |
|
182 | + WikibaseRepo::getUnitConverter($services) |
|
183 | 183 | ); |
184 | 184 | }, |
185 | 185 | |
186 | - ConstraintCheckerServices::SINGLE_BEST_VALUE_CHECKER => function ( MediaWikiServices $services ) { |
|
186 | + ConstraintCheckerServices::SINGLE_BEST_VALUE_CHECKER => function(MediaWikiServices $services) { |
|
187 | 187 | return new SingleBestValueChecker( |
188 | - ConstraintsServices::getConstraintParameterParser( $services ) |
|
188 | + ConstraintsServices::getConstraintParameterParser($services) |
|
189 | 189 | ); |
190 | 190 | }, |
191 | 191 | |
192 | - ConstraintCheckerServices::ENTITY_TYPE_CHECKER => function ( MediaWikiServices $services ) { |
|
192 | + ConstraintCheckerServices::ENTITY_TYPE_CHECKER => function(MediaWikiServices $services) { |
|
193 | 193 | return new EntityTypeChecker( |
194 | - ConstraintsServices::getConstraintParameterParser( $services ) |
|
194 | + ConstraintsServices::getConstraintParameterParser($services) |
|
195 | 195 | ); |
196 | 196 | }, |
197 | 197 | |
198 | - ConstraintCheckerServices::NONE_OF_CHECKER => function ( MediaWikiServices $services ) { |
|
198 | + ConstraintCheckerServices::NONE_OF_CHECKER => function(MediaWikiServices $services) { |
|
199 | 199 | return new NoneOfChecker( |
200 | - ConstraintsServices::getConstraintParameterParser( $services ) |
|
200 | + ConstraintsServices::getConstraintParameterParser($services) |
|
201 | 201 | ); |
202 | 202 | }, |
203 | 203 | |
204 | - ConstraintCheckerServices::INTEGER_CHECKER => function ( MediaWikiServices $services ) { |
|
204 | + ConstraintCheckerServices::INTEGER_CHECKER => function(MediaWikiServices $services) { |
|
205 | 205 | return new IntegerChecker(); |
206 | 206 | }, |
207 | 207 | |
208 | - ConstraintCheckerServices::CITATION_NEEDED_CHECKER => function ( MediaWikiServices $services ) { |
|
208 | + ConstraintCheckerServices::CITATION_NEEDED_CHECKER => function(MediaWikiServices $services) { |
|
209 | 209 | return new CitationNeededChecker(); |
210 | 210 | }, |
211 | 211 | |
212 | - ConstraintCheckerServices::PROPERTY_SCOPE_CHECKER => function ( MediaWikiServices $services ) { |
|
212 | + ConstraintCheckerServices::PROPERTY_SCOPE_CHECKER => function(MediaWikiServices $services) { |
|
213 | 213 | return new PropertyScopeChecker( |
214 | - ConstraintsServices::getConstraintParameterParser( $services ) |
|
214 | + ConstraintsServices::getConstraintParameterParser($services) |
|
215 | 215 | ); |
216 | 216 | }, |
217 | 217 | |
218 | - ConstraintCheckerServices::CONTEMPORARY_CHECKER => function ( MediaWikiServices $services ) { |
|
218 | + ConstraintCheckerServices::CONTEMPORARY_CHECKER => function(MediaWikiServices $services) { |
|
219 | 219 | return new ContemporaryChecker( |
220 | - WikibaseServices::getEntityLookup( $services ), |
|
221 | - ConstraintsServices::getRangeCheckerHelper( $services ), |
|
220 | + WikibaseServices::getEntityLookup($services), |
|
221 | + ConstraintsServices::getRangeCheckerHelper($services), |
|
222 | 222 | $services->getMainConfig() |
223 | 223 | ); |
224 | 224 | }, |
@@ -28,27 +28,27 @@ discard block |
||
28 | 28 | /** |
29 | 29 | * @param DatabaseUpdater $updater |
30 | 30 | */ |
31 | - public static function onCreateSchema( DatabaseUpdater $updater ) { |
|
32 | - $dir = dirname( __DIR__ ) . '/sql/'; |
|
31 | + public static function onCreateSchema(DatabaseUpdater $updater) { |
|
32 | + $dir = dirname(__DIR__).'/sql/'; |
|
33 | 33 | |
34 | 34 | $updater->addExtensionTable( |
35 | 35 | 'wbqc_constraints', |
36 | - $dir . "/{$updater->getDB()->getType()}/tables-generated.sql" |
|
36 | + $dir."/{$updater->getDB()->getType()}/tables-generated.sql" |
|
37 | 37 | ); |
38 | 38 | $updater->addExtensionField( |
39 | 39 | 'wbqc_constraints', |
40 | 40 | 'constraint_id', |
41 | - $dir . '/patch-wbqc_constraints-constraint_id.sql' |
|
41 | + $dir.'/patch-wbqc_constraints-constraint_id.sql' |
|
42 | 42 | ); |
43 | 43 | $updater->addExtensionIndex( |
44 | 44 | 'wbqc_constraints', |
45 | 45 | 'wbqc_constraints_guid_uniq', |
46 | - $dir . '/patch-wbqc_constraints-wbqc_constraints_guid_uniq.sql' |
|
46 | + $dir.'/patch-wbqc_constraints-wbqc_constraints_guid_uniq.sql' |
|
47 | 47 | ); |
48 | 48 | } |
49 | 49 | |
50 | - public static function onWikibaseChange( Change $change ) { |
|
51 | - if ( !( $change instanceof EntityChange ) ) { |
|
50 | + public static function onWikibaseChange(Change $change) { |
|
51 | + if (!($change instanceof EntityChange)) { |
|
52 | 52 | return; |
53 | 53 | } |
54 | 54 | |
@@ -57,48 +57,48 @@ discard block |
||
57 | 57 | |
58 | 58 | // If jobs are enabled and the results would be stored in some way run a job. |
59 | 59 | if ( |
60 | - $config->get( 'WBQualityConstraintsEnableConstraintsCheckJobs' ) && |
|
61 | - $config->get( 'WBQualityConstraintsCacheCheckConstraintsResults' ) && |
|
60 | + $config->get('WBQualityConstraintsEnableConstraintsCheckJobs') && |
|
61 | + $config->get('WBQualityConstraintsCacheCheckConstraintsResults') && |
|
62 | 62 | self::isSelectedForJobRunBasedOnPercentage() |
63 | 63 | ) { |
64 | - $params = [ 'entityId' => $change->getEntityId()->getSerialization() ]; |
|
64 | + $params = ['entityId' => $change->getEntityId()->getSerialization()]; |
|
65 | 65 | JobQueueGroup::singleton()->lazyPush( |
66 | - new JobSpecification( CheckConstraintsJob::COMMAND, $params ) |
|
66 | + new JobSpecification(CheckConstraintsJob::COMMAND, $params) |
|
67 | 67 | ); |
68 | 68 | } |
69 | 69 | |
70 | - if ( $config->get( 'WBQualityConstraintsEnableConstraintsImportFromStatements' ) && |
|
71 | - self::isConstraintStatementsChange( $config, $change ) |
|
70 | + if ($config->get('WBQualityConstraintsEnableConstraintsImportFromStatements') && |
|
71 | + self::isConstraintStatementsChange($config, $change) |
|
72 | 72 | ) { |
73 | - $params = [ 'propertyId' => $change->getEntityId()->getSerialization() ]; |
|
73 | + $params = ['propertyId' => $change->getEntityId()->getSerialization()]; |
|
74 | 74 | $metadata = $change->getMetadata(); |
75 | - if ( array_key_exists( 'rev_id', $metadata ) ) { |
|
75 | + if (array_key_exists('rev_id', $metadata)) { |
|
76 | 76 | $params['revisionId'] = $metadata['rev_id']; |
77 | 77 | } |
78 | 78 | JobQueueGroup::singleton()->push( |
79 | - new JobSpecification( 'constraintsTableUpdate', $params ) |
|
79 | + new JobSpecification('constraintsTableUpdate', $params) |
|
80 | 80 | ); |
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
84 | 84 | private static function isSelectedForJobRunBasedOnPercentage() { |
85 | 85 | $config = MediaWikiServices::getInstance()->getMainConfig(); |
86 | - $percentage = $config->get( 'WBQualityConstraintsEnableConstraintsCheckJobsRatio' ); |
|
86 | + $percentage = $config->get('WBQualityConstraintsEnableConstraintsCheckJobsRatio'); |
|
87 | 87 | |
88 | - return mt_rand( 1, 100 ) <= $percentage; |
|
88 | + return mt_rand(1, 100) <= $percentage; |
|
89 | 89 | } |
90 | 90 | |
91 | - public static function isConstraintStatementsChange( Config $config, Change $change ) { |
|
92 | - if ( !( $change instanceof EntityChange ) || |
|
91 | + public static function isConstraintStatementsChange(Config $config, Change $change) { |
|
92 | + if (!($change instanceof EntityChange) || |
|
93 | 93 | $change->getAction() !== EntityChange::UPDATE || |
94 | - !( $change->getEntityId() instanceof PropertyId ) |
|
94 | + !($change->getEntityId() instanceof PropertyId) |
|
95 | 95 | ) { |
96 | 96 | return false; |
97 | 97 | } |
98 | 98 | |
99 | 99 | $info = $change->getInfo(); |
100 | 100 | |
101 | - if ( !array_key_exists( 'compactDiff', $info ) ) { |
|
101 | + if (!array_key_exists('compactDiff', $info)) { |
|
102 | 102 | // the non-compact diff ($info['diff']) does not contain statement diffs (T110996), |
103 | 103 | // so we only know that the change *might* affect the constraint statements |
104 | 104 | return true; |
@@ -107,43 +107,43 @@ discard block |
||
107 | 107 | /** @var EntityDiffChangedAspects $aspects */ |
108 | 108 | $aspects = $info['compactDiff']; |
109 | 109 | |
110 | - $propertyConstraintId = $config->get( 'WBQualityConstraintsPropertyConstraintId' ); |
|
111 | - return in_array( $propertyConstraintId, $aspects->getStatementChanges() ); |
|
110 | + $propertyConstraintId = $config->get('WBQualityConstraintsPropertyConstraintId'); |
|
111 | + return in_array($propertyConstraintId, $aspects->getStatementChanges()); |
|
112 | 112 | } |
113 | 113 | |
114 | - public static function onArticlePurge( WikiPage $wikiPage ) { |
|
114 | + public static function onArticlePurge(WikiPage $wikiPage) { |
|
115 | 115 | $entityContentFactory = WikibaseRepo::getEntityContentFactory(); |
116 | - if ( $entityContentFactory->isEntityContentModel( $wikiPage->getContentModel() ) ) { |
|
116 | + if ($entityContentFactory->isEntityContentModel($wikiPage->getContentModel())) { |
|
117 | 117 | $entityIdLookup = WikibaseRepo::getEntityIdLookup(); |
118 | - $entityId = $entityIdLookup->getEntityIdForTitle( $wikiPage->getTitle() ); |
|
119 | - if ( $entityId !== null ) { |
|
118 | + $entityId = $entityIdLookup->getEntityIdForTitle($wikiPage->getTitle()); |
|
119 | + if ($entityId !== null) { |
|
120 | 120 | $resultsCache = ResultsCache::getDefaultInstance(); |
121 | - $resultsCache->delete( $entityId ); |
|
121 | + $resultsCache->delete($entityId); |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
126 | - public static function onBeforePageDisplay( OutputPage $out, Skin $skin ) { |
|
126 | + public static function onBeforePageDisplay(OutputPage $out, Skin $skin) { |
|
127 | 127 | $lookup = WikibaseRepo::getEntityNamespaceLookup(); |
128 | 128 | $title = $out->getTitle(); |
129 | - if ( $title === null ) { |
|
129 | + if ($title === null) { |
|
130 | 130 | return; |
131 | 131 | } |
132 | 132 | |
133 | - if ( !$lookup->isNamespaceWithEntities( $title->getNamespace() ) ) { |
|
133 | + if (!$lookup->isNamespaceWithEntities($title->getNamespace())) { |
|
134 | 134 | return; |
135 | 135 | } |
136 | - if ( empty( $out->getJsConfigVars()['wbIsEditView'] ) ) { |
|
136 | + if (empty($out->getJsConfigVars()['wbIsEditView'])) { |
|
137 | 137 | return; |
138 | 138 | } |
139 | 139 | |
140 | - $out->addModules( 'wikibase.quality.constraints.suggestions' ); |
|
140 | + $out->addModules('wikibase.quality.constraints.suggestions'); |
|
141 | 141 | |
142 | - if ( !$out->getUser()->isRegistered() ) { |
|
142 | + if (!$out->getUser()->isRegistered()) { |
|
143 | 143 | return; |
144 | 144 | } |
145 | 145 | |
146 | - $out->addModules( 'wikibase.quality.constraints.gadget' ); |
|
146 | + $out->addModules('wikibase.quality.constraints.gadget'); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | } |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | use Wikibase\Repo\WikibaseRepo; |
18 | 18 | |
19 | 19 | // @codeCoverageIgnoreStart |
20 | -$basePath = getenv( "MW_INSTALL_PATH" ) !== false |
|
21 | - ? getenv( "MW_INSTALL_PATH" ) : __DIR__ . "/../../.."; |
|
20 | +$basePath = getenv("MW_INSTALL_PATH") !== false |
|
21 | + ? getenv("MW_INSTALL_PATH") : __DIR__."/../../.."; |
|
22 | 22 | |
23 | -require_once $basePath . "/maintenance/Maintenance.php"; |
|
23 | +require_once $basePath."/maintenance/Maintenance.php"; |
|
24 | 24 | // @codeCoverageIgnoreEnd |
25 | 25 | |
26 | 26 | /** |
@@ -59,20 +59,20 @@ discard block |
||
59 | 59 | parent::__construct(); |
60 | 60 | |
61 | 61 | $this->addDescription( |
62 | - 'Import entities needed for constraint checks ' . |
|
62 | + 'Import entities needed for constraint checks '. |
|
63 | 63 | 'from Wikidata into the local repository.' |
64 | 64 | ); |
65 | 65 | $this->addOption( |
66 | 66 | 'config-format', |
67 | - 'The format in which the resulting configuration will be omitted: ' . |
|
68 | - '"globals" for directly settings global variables, suitable for inclusion in LocalSettings.php (default), ' . |
|
67 | + 'The format in which the resulting configuration will be omitted: '. |
|
68 | + '"globals" for directly settings global variables, suitable for inclusion in LocalSettings.php (default), '. |
|
69 | 69 | 'or "wgConf" for printing parts of arrays suitable for inclusion in $wgConf->settings.' |
70 | 70 | ); |
71 | 71 | $this->addOption( |
72 | 72 | 'dry-run', |
73 | 73 | 'Don’t actually import entities, just print which ones would be imported.' |
74 | 74 | ); |
75 | - $this->requireExtension( 'WikibaseQualityConstraints' ); |
|
75 | + $this->requireExtension('WikibaseQualityConstraints'); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -81,12 +81,12 @@ discard block |
||
81 | 81 | private function setupServices() { |
82 | 82 | $services = MediaWikiServices::getInstance(); |
83 | 83 | $repo = WikibaseRepo::getDefaultInstance(); |
84 | - $this->entitySerializer = WikibaseRepo::getAllTypesEntitySerializer( $services ); |
|
84 | + $this->entitySerializer = WikibaseRepo::getAllTypesEntitySerializer($services); |
|
85 | 85 | $this->entityDeserializer = WikibaseRepo::getInternalFormatEntityDeserializer(); |
86 | 86 | $this->entityStore = $repo->getEntityStore(); |
87 | 87 | $this->httpRequestFactory = $services->getHttpRequestFactory(); |
88 | - if ( !$this->getOption( 'dry-run', false ) ) { |
|
89 | - $this->user = User::newSystemUser( 'WikibaseQualityConstraints importer' ); |
|
88 | + if (!$this->getOption('dry-run', false)) { |
|
89 | + $this->user = User::newSystemUser('WikibaseQualityConstraints importer'); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
@@ -95,21 +95,21 @@ discard block |
||
95 | 95 | |
96 | 96 | $configUpdates = []; |
97 | 97 | |
98 | - $extensionJsonFile = __DIR__ . '/../extension.json'; |
|
99 | - $extensionJsonText = file_get_contents( $extensionJsonFile ); |
|
100 | - $extensionJson = json_decode( $extensionJsonText, /* assoc = */ true ); |
|
98 | + $extensionJsonFile = __DIR__.'/../extension.json'; |
|
99 | + $extensionJsonText = file_get_contents($extensionJsonFile); |
|
100 | + $extensionJson = json_decode($extensionJsonText, /* assoc = */ true); |
|
101 | 101 | // @phan-suppress-next-line PhanTypeArraySuspiciousNullable |
102 | - $wikidataEntityIds = $this->getEntitiesToImport( $extensionJson['config'], $this->getConfig() ); |
|
102 | + $wikidataEntityIds = $this->getEntitiesToImport($extensionJson['config'], $this->getConfig()); |
|
103 | 103 | |
104 | - foreach ( $wikidataEntityIds as $key => $wikidataEntityId ) { |
|
105 | - $localEntityId = $this->importEntityFromWikidata( $wikidataEntityId ); |
|
104 | + foreach ($wikidataEntityIds as $key => $wikidataEntityId) { |
|
105 | + $localEntityId = $this->importEntityFromWikidata($wikidataEntityId); |
|
106 | 106 | $configUpdates[$key] = [ |
107 | 107 | 'wikidata' => $wikidataEntityId, |
108 | 108 | 'local' => $localEntityId, |
109 | 109 | ]; |
110 | 110 | } |
111 | 111 | |
112 | - $this->outputConfigUpdates( $configUpdates ); |
|
112 | + $this->outputConfigUpdates($configUpdates); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -117,18 +117,18 @@ discard block |
||
117 | 117 | * @param Config $wikiConfig |
118 | 118 | * @return string[] |
119 | 119 | */ |
120 | - private function getEntitiesToImport( array $extensionJsonConfig, Config $wikiConfig ) { |
|
120 | + private function getEntitiesToImport(array $extensionJsonConfig, Config $wikiConfig) { |
|
121 | 121 | $wikidataEntityIds = []; |
122 | 122 | |
123 | - foreach ( $extensionJsonConfig as $key => $value ) { |
|
124 | - if ( !preg_match( '/Id$/', $key ) ) { |
|
123 | + foreach ($extensionJsonConfig as $key => $value) { |
|
124 | + if (!preg_match('/Id$/', $key)) { |
|
125 | 125 | continue; |
126 | 126 | } |
127 | 127 | |
128 | 128 | $wikidataEntityId = $value['value']; |
129 | - $localEntityId = $wikiConfig->get( $key ); |
|
129 | + $localEntityId = $wikiConfig->get($key); |
|
130 | 130 | |
131 | - if ( $localEntityId === $wikidataEntityId ) { |
|
131 | + if ($localEntityId === $wikidataEntityId) { |
|
132 | 132 | $wikidataEntityIds[$key] = $wikidataEntityId; |
133 | 133 | } |
134 | 134 | } |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | * @param string $wikidataEntityId |
141 | 141 | * @return string local entity ID |
142 | 142 | */ |
143 | - private function importEntityFromWikidata( $wikidataEntityId ) { |
|
143 | + private function importEntityFromWikidata($wikidataEntityId) { |
|
144 | 144 | $wikidataEntityUrl = "https://www.wikidata.org/wiki/Special:EntityData/$wikidataEntityId.json"; |
145 | - $wikidataEntitiesJson = $this->httpRequestFactory->get( $wikidataEntityUrl, [], __METHOD__ ); |
|
146 | - return $this->importEntityFromJson( $wikidataEntityId, $wikidataEntitiesJson ); |
|
145 | + $wikidataEntitiesJson = $this->httpRequestFactory->get($wikidataEntityUrl, [], __METHOD__); |
|
146 | + return $this->importEntityFromJson($wikidataEntityId, $wikidataEntitiesJson); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -151,24 +151,24 @@ discard block |
||
151 | 151 | * @param string $wikidataEntitiesJson |
152 | 152 | * @return string local entity ID |
153 | 153 | */ |
154 | - private function importEntityFromJson( $wikidataEntityId, $wikidataEntitiesJson ) { |
|
154 | + private function importEntityFromJson($wikidataEntityId, $wikidataEntitiesJson) { |
|
155 | 155 | // @phan-suppress-next-line PhanTypeArraySuspiciousNullable |
156 | - $wikidataEntityArray = json_decode( $wikidataEntitiesJson, true )['entities'][$wikidataEntityId]; |
|
157 | - $wikidataEntity = $this->entityDeserializer->deserialize( $wikidataEntityArray ); |
|
156 | + $wikidataEntityArray = json_decode($wikidataEntitiesJson, true)['entities'][$wikidataEntityId]; |
|
157 | + $wikidataEntity = $this->entityDeserializer->deserialize($wikidataEntityArray); |
|
158 | 158 | |
159 | - $wikidataEntity->setId( null ); |
|
159 | + $wikidataEntity->setId(null); |
|
160 | 160 | |
161 | - if ( $wikidataEntity instanceof StatementListProvider ) { |
|
161 | + if ($wikidataEntity instanceof StatementListProvider) { |
|
162 | 162 | $wikidataEntity->getStatements()->clear(); |
163 | 163 | } |
164 | 164 | |
165 | - if ( $wikidataEntity instanceof Item ) { |
|
166 | - $wikidataEntity->setSiteLinkList( new SiteLinkList() ); |
|
165 | + if ($wikidataEntity instanceof Item) { |
|
166 | + $wikidataEntity->setSiteLinkList(new SiteLinkList()); |
|
167 | 167 | } |
168 | 168 | |
169 | - if ( $this->getOption( 'dry-run', false ) ) { |
|
170 | - $wikidataEntityJson = json_encode( $this->entitySerializer->serialize( $wikidataEntity ) ); |
|
171 | - $this->output( $wikidataEntityJson . "\n" ); |
|
169 | + if ($this->getOption('dry-run', false)) { |
|
170 | + $wikidataEntityJson = json_encode($this->entitySerializer->serialize($wikidataEntity)); |
|
171 | + $this->output($wikidataEntityJson."\n"); |
|
172 | 172 | return "-$wikidataEntityId"; |
173 | 173 | } |
174 | 174 | |
@@ -181,12 +181,12 @@ discard block |
||
181 | 181 | )->getEntity(); |
182 | 182 | |
183 | 183 | return $localEntity->getId()->getSerialization(); |
184 | - } catch ( StorageException $storageException ) { |
|
185 | - return $this->storageExceptionToEntityId( $storageException ); |
|
184 | + } catch (StorageException $storageException) { |
|
185 | + return $this->storageExceptionToEntityId($storageException); |
|
186 | 186 | } |
187 | 187 | } |
188 | 188 | |
189 | - private function storageExceptionToEntityId( StorageException $storageException ) { |
|
189 | + private function storageExceptionToEntityId(StorageException $storageException) { |
|
190 | 190 | $message = $storageException->getMessage(); |
191 | 191 | // example messages: |
192 | 192 | // * Item [[Item:Q475|Q475]] already has label "as references" |
@@ -196,25 +196,25 @@ discard block |
||
196 | 196 | // * Property [[Property:P694|P694]] already has label "instance of" |
197 | 197 | // associated with language code en. |
198 | 198 | $pattern = '/[[|]([^][|]*)]] already has label .* associated with language code/'; |
199 | - if ( preg_match( $pattern, $message, $matches ) ) { |
|
199 | + if (preg_match($pattern, $message, $matches)) { |
|
200 | 200 | return $matches[1]; |
201 | 201 | } else { |
202 | 202 | throw $storageException; |
203 | 203 | } |
204 | 204 | } |
205 | 205 | |
206 | - private function outputConfigUpdates( array $configUpdates ) { |
|
207 | - $configFormat = $this->getOption( 'config-format', 'globals' ); |
|
208 | - switch ( $configFormat ) { |
|
206 | + private function outputConfigUpdates(array $configUpdates) { |
|
207 | + $configFormat = $this->getOption('config-format', 'globals'); |
|
208 | + switch ($configFormat) { |
|
209 | 209 | case 'globals': |
210 | - $this->outputConfigUpdatesGlobals( $configUpdates ); |
|
210 | + $this->outputConfigUpdatesGlobals($configUpdates); |
|
211 | 211 | break; |
212 | 212 | case 'wgConf': |
213 | - $this->outputConfigUpdatesWgConf( $configUpdates ); |
|
213 | + $this->outputConfigUpdatesWgConf($configUpdates); |
|
214 | 214 | break; |
215 | 215 | default: |
216 | - $this->error( "Invalid config format \"$configFormat\", using \"globals\"" ); |
|
217 | - $this->outputConfigUpdatesGlobals( $configUpdates ); |
|
216 | + $this->error("Invalid config format \"$configFormat\", using \"globals\""); |
|
217 | + $this->outputConfigUpdatesGlobals($configUpdates); |
|
218 | 218 | break; |
219 | 219 | } |
220 | 220 | } |
@@ -222,22 +222,22 @@ discard block |
||
222 | 222 | /** |
223 | 223 | * @param array[] $configUpdates |
224 | 224 | */ |
225 | - private function outputConfigUpdatesGlobals( array $configUpdates ) { |
|
226 | - foreach ( $configUpdates as $key => $value ) { |
|
227 | - $localValueCode = var_export( $value['local'], true ); |
|
228 | - $this->output( "\$wg$key = $localValueCode;\n" ); |
|
225 | + private function outputConfigUpdatesGlobals(array $configUpdates) { |
|
226 | + foreach ($configUpdates as $key => $value) { |
|
227 | + $localValueCode = var_export($value['local'], true); |
|
228 | + $this->output("\$wg$key = $localValueCode;\n"); |
|
229 | 229 | } |
230 | 230 | } |
231 | 231 | |
232 | 232 | /** |
233 | 233 | * @param array[] $configUpdates |
234 | 234 | */ |
235 | - private function outputConfigUpdatesWgConf( array $configUpdates ) { |
|
236 | - foreach ( $configUpdates as $key => $value ) { |
|
237 | - $keyCode = var_export( "wg$key", true ); |
|
238 | - $wikidataValueCode = var_export( $value['wikidata'], true ); |
|
239 | - $localValueCode = var_export( $value['local'], true ); |
|
240 | - $wikiIdCode = var_export( wfWikiID(), true ); |
|
235 | + private function outputConfigUpdatesWgConf(array $configUpdates) { |
|
236 | + foreach ($configUpdates as $key => $value) { |
|
237 | + $keyCode = var_export("wg$key", true); |
|
238 | + $wikidataValueCode = var_export($value['wikidata'], true); |
|
239 | + $localValueCode = var_export($value['local'], true); |
|
240 | + $wikiIdCode = var_export(wfWikiID(), true); |
|
241 | 241 | $block = <<< EOF |
242 | 242 | $keyCode => [ |
243 | 243 | 'default' => $wikidataValueCode, |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | |
247 | 247 | |
248 | 248 | EOF; |
249 | - $this->output( $block ); |
|
249 | + $this->output($block); |
|
250 | 250 | } |
251 | 251 | } |
252 | 252 |
@@ -11,10 +11,10 @@ discard block |
||
11 | 11 | use Wikimedia\Rdbms\ILBFactory; |
12 | 12 | |
13 | 13 | // @codeCoverageIgnoreStart |
14 | -$basePath = getenv( "MW_INSTALL_PATH" ) !== false |
|
15 | - ? getenv( "MW_INSTALL_PATH" ) : __DIR__ . "/../../.."; |
|
14 | +$basePath = getenv("MW_INSTALL_PATH") !== false |
|
15 | + ? getenv("MW_INSTALL_PATH") : __DIR__."/../../.."; |
|
16 | 16 | |
17 | -require_once $basePath . "/maintenance/Maintenance.php"; |
|
17 | +require_once $basePath."/maintenance/Maintenance.php"; |
|
18 | 18 | // @codeCoverageIgnoreEnd |
19 | 19 | |
20 | 20 | /** |
@@ -46,57 +46,57 @@ discard block |
||
46 | 46 | |
47 | 47 | public function __construct() { |
48 | 48 | parent::__construct(); |
49 | - $this->newUpdateConstraintsTableJob = function ( $propertyIdSerialization ) { |
|
49 | + $this->newUpdateConstraintsTableJob = function($propertyIdSerialization) { |
|
50 | 50 | return UpdateConstraintsTableJob::newFromGlobalState( |
51 | 51 | Title::newMainPage(), |
52 | - [ 'propertyId' => $propertyIdSerialization ] |
|
52 | + ['propertyId' => $propertyIdSerialization] |
|
53 | 53 | ); |
54 | 54 | }; |
55 | 55 | |
56 | - $this->addDescription( 'Imports property constraints from statements on properties' ); |
|
57 | - $this->requireExtension( 'WikibaseQualityConstraints' ); |
|
58 | - $this->setBatchSize( 10 ); |
|
56 | + $this->addDescription('Imports property constraints from statements on properties'); |
|
57 | + $this->requireExtension('WikibaseQualityConstraints'); |
|
58 | + $this->setBatchSize(10); |
|
59 | 59 | |
60 | 60 | // Wikibase classes are not yet loaded, so setup services in a callback run in execute |
61 | 61 | // that can be overridden in tests. |
62 | - $this->setupServices = function () { |
|
62 | + $this->setupServices = function() { |
|
63 | 63 | $services = MediaWikiServices::getInstance(); |
64 | - $this->propertyInfoLookup = WikibaseRepo::getStore( $services )->getPropertyInfoLookup(); |
|
64 | + $this->propertyInfoLookup = WikibaseRepo::getStore($services)->getPropertyInfoLookup(); |
|
65 | 65 | $this->lbFactory = $services->getDBLoadBalancerFactory(); |
66 | 66 | }; |
67 | 67 | } |
68 | 68 | |
69 | 69 | public function execute() { |
70 | - ( $this->setupServices )(); |
|
71 | - if ( !$this->getConfig()->get( 'WBQualityConstraintsEnableConstraintsImportFromStatements' ) ) { |
|
72 | - $this->error( 'Constraint statements are not enabled. Aborting.' ); |
|
70 | + ($this->setupServices)(); |
|
71 | + if (!$this->getConfig()->get('WBQualityConstraintsEnableConstraintsImportFromStatements')) { |
|
72 | + $this->error('Constraint statements are not enabled. Aborting.'); |
|
73 | 73 | return; |
74 | 74 | } |
75 | 75 | |
76 | 76 | $propertyInfos = $this->propertyInfoLookup->getAllPropertyInfo(); |
77 | - $propertyIds = array_keys( $propertyInfos ); |
|
77 | + $propertyIds = array_keys($propertyInfos); |
|
78 | 78 | |
79 | - foreach ( array_chunk( $propertyIds, $this->getBatchSize() ) as $propertyIdsChunk ) { |
|
80 | - foreach ( $propertyIdsChunk as $propertyIdSerialization ) { |
|
81 | - $this->output( sprintf( |
|
79 | + foreach (array_chunk($propertyIds, $this->getBatchSize()) as $propertyIdsChunk) { |
|
80 | + foreach ($propertyIdsChunk as $propertyIdSerialization) { |
|
81 | + $this->output(sprintf( |
|
82 | 82 | 'Importing constraint statements for % 6s... ', |
83 | 83 | $propertyIdSerialization ), |
84 | 84 | $propertyIdSerialization |
85 | 85 | ); |
86 | - $startTime = microtime( true ); |
|
87 | - $job = call_user_func( $this->newUpdateConstraintsTableJob, $propertyIdSerialization ); |
|
86 | + $startTime = microtime(true); |
|
87 | + $job = call_user_func($this->newUpdateConstraintsTableJob, $propertyIdSerialization); |
|
88 | 88 | $job->run(); |
89 | - $endTime = microtime( true ); |
|
90 | - $millis = ( $endTime - $startTime ) * 1000; |
|
91 | - $this->output( sprintf( 'done in % 6.2f ms.', $millis ), $propertyIdSerialization ); |
|
89 | + $endTime = microtime(true); |
|
90 | + $millis = ($endTime - $startTime) * 1000; |
|
91 | + $this->output(sprintf('done in % 6.2f ms.', $millis), $propertyIdSerialization); |
|
92 | 92 | } |
93 | 93 | |
94 | - $this->output( 'Waiting for replication... ', 'waitForReplication' ); |
|
95 | - $startTime = microtime( true ); |
|
94 | + $this->output('Waiting for replication... ', 'waitForReplication'); |
|
95 | + $startTime = microtime(true); |
|
96 | 96 | $this->lbFactory->waitForReplication(); |
97 | - $endTime = microtime( true ); |
|
98 | - $millis = ( $endTime - $startTime ) * 1000; |
|
99 | - $this->output( sprintf( 'done in % 6.2f ms.', $millis ), 'waitForReplication' ); |
|
97 | + $endTime = microtime(true); |
|
98 | + $millis = ($endTime - $startTime) * 1000; |
|
99 | + $this->output(sprintf('done in % 6.2f ms.', $millis), 'waitForReplication'); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 |
@@ -28,46 +28,46 @@ discard block |
||
28 | 28 | use WikibaseQuality\ConstraintReport\ConstraintCheck\Result\CheckResultSerializer; |
29 | 29 | |
30 | 30 | return [ |
31 | - ConstraintsServices::EXPIRY_LOCK => function ( MediaWikiServices $services ) { |
|
32 | - return new ExpiryLock( ObjectCache::getInstance( CACHE_ANYTHING ) ); |
|
31 | + ConstraintsServices::EXPIRY_LOCK => function(MediaWikiServices $services) { |
|
32 | + return new ExpiryLock(ObjectCache::getInstance(CACHE_ANYTHING)); |
|
33 | 33 | }, |
34 | 34 | |
35 | - ConstraintsServices::LOGGING_HELPER => function ( MediaWikiServices $services ) { |
|
35 | + ConstraintsServices::LOGGING_HELPER => function(MediaWikiServices $services) { |
|
36 | 36 | return new LoggingHelper( |
37 | 37 | $services->getStatsdDataFactory(), |
38 | - LoggerFactory::getInstance( 'WikibaseQualityConstraints' ), |
|
38 | + LoggerFactory::getInstance('WikibaseQualityConstraints'), |
|
39 | 39 | $services->getMainConfig() |
40 | 40 | ); |
41 | 41 | }, |
42 | 42 | |
43 | - ConstraintsServices::CONSTRAINT_STORE => function ( MediaWikiServices $services ) { |
|
44 | - $sourceDefinitions = WikibaseRepo::getEntitySourceDefinitions( $services ); |
|
45 | - $propertySource = $sourceDefinitions->getSourceForEntityType( Property::ENTITY_TYPE ); |
|
43 | + ConstraintsServices::CONSTRAINT_STORE => function(MediaWikiServices $services) { |
|
44 | + $sourceDefinitions = WikibaseRepo::getEntitySourceDefinitions($services); |
|
45 | + $propertySource = $sourceDefinitions->getSourceForEntityType(Property::ENTITY_TYPE); |
|
46 | 46 | $dbName = $propertySource->getDatabaseName(); |
47 | - $localEntitySourceName = WikibaseRepo::getLocalEntitySource( $services )->getSourceName(); |
|
47 | + $localEntitySourceName = WikibaseRepo::getLocalEntitySource($services)->getSourceName(); |
|
48 | 48 | |
49 | - if ( $propertySource->getSourceName() !== $localEntitySourceName ) { |
|
50 | - throw new \RuntimeException( 'Can\'t get a ConstraintStore for a non local entity source.' ); |
|
49 | + if ($propertySource->getSourceName() !== $localEntitySourceName) { |
|
50 | + throw new \RuntimeException('Can\'t get a ConstraintStore for a non local entity source.'); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | return new ConstraintRepositoryStore( |
54 | - $services->getDBLoadBalancerFactory()->getMainLB( $dbName ), |
|
54 | + $services->getDBLoadBalancerFactory()->getMainLB($dbName), |
|
55 | 55 | $dbName |
56 | 56 | ); |
57 | 57 | }, |
58 | 58 | |
59 | - ConstraintsServices::CONSTRAINT_LOOKUP => function ( MediaWikiServices $services ) { |
|
60 | - $sourceDefinitions = WikibaseRepo::getEntitySourceDefinitions( $services ); |
|
61 | - $propertySource = $sourceDefinitions->getSourceForEntityType( Property::ENTITY_TYPE ); |
|
59 | + ConstraintsServices::CONSTRAINT_LOOKUP => function(MediaWikiServices $services) { |
|
60 | + $sourceDefinitions = WikibaseRepo::getEntitySourceDefinitions($services); |
|
61 | + $propertySource = $sourceDefinitions->getSourceForEntityType(Property::ENTITY_TYPE); |
|
62 | 62 | $dbName = $propertySource->getDatabaseName(); |
63 | 63 | $rawLookup = new ConstraintRepositoryLookup( |
64 | - $services->getDBLoadBalancerFactory()->getMainLB( $dbName ), |
|
64 | + $services->getDBLoadBalancerFactory()->getMainLB($dbName), |
|
65 | 65 | $dbName |
66 | 66 | ); |
67 | - return new CachingConstraintLookup( $rawLookup ); |
|
67 | + return new CachingConstraintLookup($rawLookup); |
|
68 | 68 | }, |
69 | 69 | |
70 | - ConstraintsServices::CHECK_RESULT_SERIALIZER => function ( MediaWikiServices $services ) { |
|
70 | + ConstraintsServices::CHECK_RESULT_SERIALIZER => function(MediaWikiServices $services) { |
|
71 | 71 | return new CheckResultSerializer( |
72 | 72 | new ConstraintSerializer( |
73 | 73 | false // constraint parameters are not exposed |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | ); |
79 | 79 | }, |
80 | 80 | |
81 | - ConstraintsServices::CHECK_RESULT_DESERIALIZER => function ( MediaWikiServices $services ) { |
|
82 | - $entityIdParser = WikibaseRepo::getEntityIdParser( $services ); |
|
83 | - $dataValueFactory = WikibaseRepo::getDataValueFactory( $services ); |
|
81 | + ConstraintsServices::CHECK_RESULT_DESERIALIZER => function(MediaWikiServices $services) { |
|
82 | + $entityIdParser = WikibaseRepo::getEntityIdParser($services); |
|
83 | + $dataValueFactory = WikibaseRepo::getDataValueFactory($services); |
|
84 | 84 | |
85 | 85 | return new CheckResultDeserializer( |
86 | 86 | new ConstraintDeserializer(), |
@@ -93,13 +93,13 @@ discard block |
||
93 | 93 | ); |
94 | 94 | }, |
95 | 95 | |
96 | - ConstraintsServices::VIOLATION_MESSAGE_SERIALIZER => function ( MediaWikiServices $services ) { |
|
96 | + ConstraintsServices::VIOLATION_MESSAGE_SERIALIZER => function(MediaWikiServices $services) { |
|
97 | 97 | return new ViolationMessageSerializer(); |
98 | 98 | }, |
99 | 99 | |
100 | - ConstraintsServices::VIOLATION_MESSAGE_DESERIALIZER => function ( MediaWikiServices $services ) { |
|
101 | - $entityIdParser = WikibaseRepo::getEntityIdParser( $services ); |
|
102 | - $dataValueFactory = WikibaseRepo::getDataValueFactory( $services ); |
|
100 | + ConstraintsServices::VIOLATION_MESSAGE_DESERIALIZER => function(MediaWikiServices $services) { |
|
101 | + $entityIdParser = WikibaseRepo::getEntityIdParser($services); |
|
102 | + $dataValueFactory = WikibaseRepo::getDataValueFactory($services); |
|
103 | 103 | |
104 | 104 | return new ViolationMessageDeserializer( |
105 | 105 | $entityIdParser, |
@@ -107,38 +107,38 @@ discard block |
||
107 | 107 | ); |
108 | 108 | }, |
109 | 109 | |
110 | - ConstraintsServices::CONSTRAINT_PARAMETER_PARSER => function ( MediaWikiServices $services ) { |
|
111 | - $deserializerFactory = WikibaseRepo::getBaseDataModelDeserializerFactory( $services ); |
|
112 | - $entitySourceDefinitions = WikibaseRepo::getEntitySourceDefinitions( $services ); |
|
110 | + ConstraintsServices::CONSTRAINT_PARAMETER_PARSER => function(MediaWikiServices $services) { |
|
111 | + $deserializerFactory = WikibaseRepo::getBaseDataModelDeserializerFactory($services); |
|
112 | + $entitySourceDefinitions = WikibaseRepo::getEntitySourceDefinitions($services); |
|
113 | 113 | |
114 | 114 | return new ConstraintParameterParser( |
115 | 115 | $services->getMainConfig(), |
116 | 116 | $deserializerFactory, |
117 | - $entitySourceDefinitions->getSourceForEntityType( 'item' )->getConceptBaseUri() |
|
117 | + $entitySourceDefinitions->getSourceForEntityType('item')->getConceptBaseUri() |
|
118 | 118 | ); |
119 | 119 | }, |
120 | 120 | |
121 | - ConstraintsServices::CONNECTION_CHECKER_HELPER => function ( MediaWikiServices $services ) { |
|
121 | + ConstraintsServices::CONNECTION_CHECKER_HELPER => function(MediaWikiServices $services) { |
|
122 | 122 | return new ConnectionCheckerHelper(); |
123 | 123 | }, |
124 | 124 | |
125 | - ConstraintsServices::RANGE_CHECKER_HELPER => function ( MediaWikiServices $services ) { |
|
125 | + ConstraintsServices::RANGE_CHECKER_HELPER => function(MediaWikiServices $services) { |
|
126 | 126 | return new RangeCheckerHelper( |
127 | 127 | $services->getMainConfig(), |
128 | - WikibaseRepo::getUnitConverter( $services ) |
|
128 | + WikibaseRepo::getUnitConverter($services) |
|
129 | 129 | ); |
130 | 130 | }, |
131 | 131 | |
132 | - ConstraintsServices::SPARQL_HELPER => function ( MediaWikiServices $services ) { |
|
133 | - $endpoint = $services->getMainConfig()->get( 'WBQualityConstraintsSparqlEndpoint' ); |
|
134 | - if ( $endpoint === '' ) { |
|
132 | + ConstraintsServices::SPARQL_HELPER => function(MediaWikiServices $services) { |
|
133 | + $endpoint = $services->getMainConfig()->get('WBQualityConstraintsSparqlEndpoint'); |
|
134 | + if ($endpoint === '') { |
|
135 | 135 | return new DummySparqlHelper(); |
136 | 136 | } |
137 | 137 | |
138 | 138 | // TODO get PropertyDataTypeLookup from $services |
139 | 139 | $repo = WikibaseRepo::getDefaultInstance(); |
140 | - $rdfVocabulary = WikibaseRepo::getRdfVocabulary( $services ); |
|
141 | - $entityIdParser = WikibaseRepo::getEntityIdParser( $services ); |
|
140 | + $rdfVocabulary = WikibaseRepo::getRdfVocabulary($services); |
|
141 | + $entityIdParser = WikibaseRepo::getEntityIdParser($services); |
|
142 | 142 | $propertyDataTypeLookup = $repo->getPropertyDataTypeLookup(); |
143 | 143 | |
144 | 144 | return new SparqlHelper( |
@@ -147,122 +147,122 @@ discard block |
||
147 | 147 | $entityIdParser, |
148 | 148 | $propertyDataTypeLookup, |
149 | 149 | $services->getMainWANObjectCache(), |
150 | - ConstraintsServices::getViolationMessageSerializer( $services ), |
|
151 | - ConstraintsServices::getViolationMessageDeserializer( $services ), |
|
150 | + ConstraintsServices::getViolationMessageSerializer($services), |
|
151 | + ConstraintsServices::getViolationMessageDeserializer($services), |
|
152 | 152 | $services->getStatsdDataFactory(), |
153 | - ConstraintsServices::getExpiryLock( $services ), |
|
153 | + ConstraintsServices::getExpiryLock($services), |
|
154 | 154 | ConstraintsServices::getLoggingHelper(), |
155 | - wfWikiID() . ' WikibaseQualityConstraints ' . Http::userAgent(), |
|
155 | + wfWikiID().' WikibaseQualityConstraints '.Http::userAgent(), |
|
156 | 156 | $services->getHttpRequestFactory() |
157 | 157 | ); |
158 | 158 | }, |
159 | 159 | |
160 | - ConstraintsServices::TYPE_CHECKER_HELPER => function ( MediaWikiServices $services ) { |
|
160 | + ConstraintsServices::TYPE_CHECKER_HELPER => function(MediaWikiServices $services) { |
|
161 | 161 | return new TypeCheckerHelper( |
162 | - WikibaseServices::getEntityLookup( $services ), |
|
162 | + WikibaseServices::getEntityLookup($services), |
|
163 | 163 | $services->getMainConfig(), |
164 | - ConstraintsServices::getSparqlHelper( $services ), |
|
164 | + ConstraintsServices::getSparqlHelper($services), |
|
165 | 165 | $services->getStatsdDataFactory() |
166 | 166 | ); |
167 | 167 | }, |
168 | 168 | |
169 | - ConstraintsServices::DELEGATING_CONSTRAINT_CHECKER => function ( MediaWikiServices $services ) { |
|
170 | - $statementGuidParser = WikibaseRepo::getStatementGuidParser( $services ); |
|
169 | + ConstraintsServices::DELEGATING_CONSTRAINT_CHECKER => function(MediaWikiServices $services) { |
|
170 | + $statementGuidParser = WikibaseRepo::getStatementGuidParser($services); |
|
171 | 171 | |
172 | 172 | $config = $services->getMainConfig(); |
173 | 173 | $checkerMap = [ |
174 | - $config->get( 'WBQualityConstraintsConflictsWithConstraintId' ) |
|
175 | - => ConstraintCheckerServices::getConflictsWithChecker( $services ), |
|
176 | - $config->get( 'WBQualityConstraintsItemRequiresClaimConstraintId' ) |
|
177 | - => ConstraintCheckerServices::getItemChecker( $services ), |
|
178 | - $config->get( 'WBQualityConstraintsValueRequiresClaimConstraintId' ) |
|
179 | - => ConstraintCheckerServices::getTargetRequiredClaimChecker( $services ), |
|
180 | - $config->get( 'WBQualityConstraintsSymmetricConstraintId' ) |
|
181 | - => ConstraintCheckerServices::getSymmetricChecker( $services ), |
|
182 | - $config->get( 'WBQualityConstraintsInverseConstraintId' ) |
|
183 | - => ConstraintCheckerServices::getInverseChecker( $services ), |
|
184 | - $config->get( 'WBQualityConstraintsUsedAsQualifierConstraintId' ) |
|
185 | - => ConstraintCheckerServices::getQualifierChecker( $services ), |
|
186 | - $config->get( 'WBQualityConstraintsAllowedQualifiersConstraintId' ) |
|
187 | - => ConstraintCheckerServices::getQualifiersChecker( $services ), |
|
188 | - $config->get( 'WBQualityConstraintsMandatoryQualifierConstraintId' ) |
|
189 | - => ConstraintCheckerServices::getMandatoryQualifiersChecker( $services ), |
|
190 | - $config->get( 'WBQualityConstraintsRangeConstraintId' ) |
|
191 | - => ConstraintCheckerServices::getRangeChecker( $services ), |
|
192 | - $config->get( 'WBQualityConstraintsDifferenceWithinRangeConstraintId' ) |
|
193 | - => ConstraintCheckerServices::getDiffWithinRangeChecker( $services ), |
|
194 | - $config->get( 'WBQualityConstraintsTypeConstraintId' ) |
|
195 | - => ConstraintCheckerServices::getTypeChecker( $services ), |
|
196 | - $config->get( 'WBQualityConstraintsValueTypeConstraintId' ) |
|
197 | - => ConstraintCheckerServices::getValueTypeChecker( $services ), |
|
198 | - $config->get( 'WBQualityConstraintsSingleValueConstraintId' ) |
|
199 | - => ConstraintCheckerServices::getSingleValueChecker( $services ), |
|
200 | - $config->get( 'WBQualityConstraintsMultiValueConstraintId' ) |
|
201 | - => ConstraintCheckerServices::getMultiValueChecker( $services ), |
|
202 | - $config->get( 'WBQualityConstraintsDistinctValuesConstraintId' ) |
|
203 | - => ConstraintCheckerServices::getUniqueValueChecker( $services ), |
|
204 | - $config->get( 'WBQualityConstraintsFormatConstraintId' ) |
|
205 | - => ConstraintCheckerServices::getFormatChecker( $services ), |
|
206 | - $config->get( 'WBQualityConstraintsCommonsLinkConstraintId' ) |
|
207 | - => ConstraintCheckerServices::getCommonsLinkChecker( $services ), |
|
208 | - $config->get( 'WBQualityConstraintsOneOfConstraintId' ) |
|
209 | - => ConstraintCheckerServices::getOneOfChecker( $services ), |
|
210 | - $config->get( 'WBQualityConstraintsUsedForValuesOnlyConstraintId' ) |
|
211 | - => ConstraintCheckerServices::getValueOnlyChecker( $services ), |
|
212 | - $config->get( 'WBQualityConstraintsUsedAsReferenceConstraintId' ) |
|
213 | - => ConstraintCheckerServices::getReferenceChecker( $services ), |
|
214 | - $config->get( 'WBQualityConstraintsNoBoundsConstraintId' ) |
|
215 | - => ConstraintCheckerServices::getNoBoundsChecker( $services ), |
|
216 | - $config->get( 'WBQualityConstraintsAllowedUnitsConstraintId' ) |
|
217 | - => ConstraintCheckerServices::getAllowedUnitsChecker( $services ), |
|
218 | - $config->get( 'WBQualityConstraintsSingleBestValueConstraintId' ) |
|
219 | - => ConstraintCheckerServices::getSingleBestValueChecker( $services ), |
|
220 | - $config->get( 'WBQualityConstraintsAllowedEntityTypesConstraintId' ) |
|
221 | - => ConstraintCheckerServices::getEntityTypeChecker( $services ), |
|
222 | - $config->get( 'WBQualityConstraintsNoneOfConstraintId' ) |
|
223 | - => ConstraintCheckerServices::getNoneOfChecker( $services ), |
|
224 | - $config->get( 'WBQualityConstraintsIntegerConstraintId' ) |
|
225 | - => ConstraintCheckerServices::getIntegerChecker( $services ), |
|
226 | - $config->get( 'WBQualityConstraintsCitationNeededConstraintId' ) |
|
227 | - => ConstraintCheckerServices::getCitationNeededChecker( $services ), |
|
228 | - $config->get( 'WBQualityConstraintsPropertyScopeConstraintId' ) |
|
229 | - => ConstraintCheckerServices::getPropertyScopeChecker( $services ), |
|
230 | - $config->get( 'WBQualityConstraintsContemporaryConstraintId' ) |
|
231 | - => ConstraintCheckerServices::getContemporaryChecker( $services ), |
|
174 | + $config->get('WBQualityConstraintsConflictsWithConstraintId') |
|
175 | + => ConstraintCheckerServices::getConflictsWithChecker($services), |
|
176 | + $config->get('WBQualityConstraintsItemRequiresClaimConstraintId') |
|
177 | + => ConstraintCheckerServices::getItemChecker($services), |
|
178 | + $config->get('WBQualityConstraintsValueRequiresClaimConstraintId') |
|
179 | + => ConstraintCheckerServices::getTargetRequiredClaimChecker($services), |
|
180 | + $config->get('WBQualityConstraintsSymmetricConstraintId') |
|
181 | + => ConstraintCheckerServices::getSymmetricChecker($services), |
|
182 | + $config->get('WBQualityConstraintsInverseConstraintId') |
|
183 | + => ConstraintCheckerServices::getInverseChecker($services), |
|
184 | + $config->get('WBQualityConstraintsUsedAsQualifierConstraintId') |
|
185 | + => ConstraintCheckerServices::getQualifierChecker($services), |
|
186 | + $config->get('WBQualityConstraintsAllowedQualifiersConstraintId') |
|
187 | + => ConstraintCheckerServices::getQualifiersChecker($services), |
|
188 | + $config->get('WBQualityConstraintsMandatoryQualifierConstraintId') |
|
189 | + => ConstraintCheckerServices::getMandatoryQualifiersChecker($services), |
|
190 | + $config->get('WBQualityConstraintsRangeConstraintId') |
|
191 | + => ConstraintCheckerServices::getRangeChecker($services), |
|
192 | + $config->get('WBQualityConstraintsDifferenceWithinRangeConstraintId') |
|
193 | + => ConstraintCheckerServices::getDiffWithinRangeChecker($services), |
|
194 | + $config->get('WBQualityConstraintsTypeConstraintId') |
|
195 | + => ConstraintCheckerServices::getTypeChecker($services), |
|
196 | + $config->get('WBQualityConstraintsValueTypeConstraintId') |
|
197 | + => ConstraintCheckerServices::getValueTypeChecker($services), |
|
198 | + $config->get('WBQualityConstraintsSingleValueConstraintId') |
|
199 | + => ConstraintCheckerServices::getSingleValueChecker($services), |
|
200 | + $config->get('WBQualityConstraintsMultiValueConstraintId') |
|
201 | + => ConstraintCheckerServices::getMultiValueChecker($services), |
|
202 | + $config->get('WBQualityConstraintsDistinctValuesConstraintId') |
|
203 | + => ConstraintCheckerServices::getUniqueValueChecker($services), |
|
204 | + $config->get('WBQualityConstraintsFormatConstraintId') |
|
205 | + => ConstraintCheckerServices::getFormatChecker($services), |
|
206 | + $config->get('WBQualityConstraintsCommonsLinkConstraintId') |
|
207 | + => ConstraintCheckerServices::getCommonsLinkChecker($services), |
|
208 | + $config->get('WBQualityConstraintsOneOfConstraintId') |
|
209 | + => ConstraintCheckerServices::getOneOfChecker($services), |
|
210 | + $config->get('WBQualityConstraintsUsedForValuesOnlyConstraintId') |
|
211 | + => ConstraintCheckerServices::getValueOnlyChecker($services), |
|
212 | + $config->get('WBQualityConstraintsUsedAsReferenceConstraintId') |
|
213 | + => ConstraintCheckerServices::getReferenceChecker($services), |
|
214 | + $config->get('WBQualityConstraintsNoBoundsConstraintId') |
|
215 | + => ConstraintCheckerServices::getNoBoundsChecker($services), |
|
216 | + $config->get('WBQualityConstraintsAllowedUnitsConstraintId') |
|
217 | + => ConstraintCheckerServices::getAllowedUnitsChecker($services), |
|
218 | + $config->get('WBQualityConstraintsSingleBestValueConstraintId') |
|
219 | + => ConstraintCheckerServices::getSingleBestValueChecker($services), |
|
220 | + $config->get('WBQualityConstraintsAllowedEntityTypesConstraintId') |
|
221 | + => ConstraintCheckerServices::getEntityTypeChecker($services), |
|
222 | + $config->get('WBQualityConstraintsNoneOfConstraintId') |
|
223 | + => ConstraintCheckerServices::getNoneOfChecker($services), |
|
224 | + $config->get('WBQualityConstraintsIntegerConstraintId') |
|
225 | + => ConstraintCheckerServices::getIntegerChecker($services), |
|
226 | + $config->get('WBQualityConstraintsCitationNeededConstraintId') |
|
227 | + => ConstraintCheckerServices::getCitationNeededChecker($services), |
|
228 | + $config->get('WBQualityConstraintsPropertyScopeConstraintId') |
|
229 | + => ConstraintCheckerServices::getPropertyScopeChecker($services), |
|
230 | + $config->get('WBQualityConstraintsContemporaryConstraintId') |
|
231 | + => ConstraintCheckerServices::getContemporaryChecker($services), |
|
232 | 232 | ]; |
233 | 233 | |
234 | 234 | return new DelegatingConstraintChecker( |
235 | - WikibaseServices::getEntityLookup( $services ), |
|
235 | + WikibaseServices::getEntityLookup($services), |
|
236 | 236 | $checkerMap, |
237 | - ConstraintsServices::getConstraintLookup( $services ), |
|
238 | - ConstraintsServices::getConstraintParameterParser( $services ), |
|
237 | + ConstraintsServices::getConstraintLookup($services), |
|
238 | + ConstraintsServices::getConstraintParameterParser($services), |
|
239 | 239 | $statementGuidParser, |
240 | - ConstraintsServices::getLoggingHelper( $services ), |
|
241 | - $config->get( 'WBQualityConstraintsCheckQualifiers' ), |
|
242 | - $config->get( 'WBQualityConstraintsCheckReferences' ), |
|
243 | - $config->get( 'WBQualityConstraintsPropertiesWithViolatingQualifiers' ) |
|
240 | + ConstraintsServices::getLoggingHelper($services), |
|
241 | + $config->get('WBQualityConstraintsCheckQualifiers'), |
|
242 | + $config->get('WBQualityConstraintsCheckReferences'), |
|
243 | + $config->get('WBQualityConstraintsPropertiesWithViolatingQualifiers') |
|
244 | 244 | ); |
245 | 245 | }, |
246 | 246 | |
247 | - ConstraintsServices::RESULTS_SOURCE => function ( MediaWikiServices $services ) { |
|
247 | + ConstraintsServices::RESULTS_SOURCE => function(MediaWikiServices $services) { |
|
248 | 248 | $config = $services->getMainConfig(); |
249 | 249 | $resultsSource = new CheckingResultsSource( |
250 | - ConstraintsServices::getDelegatingConstraintChecker( $services ) |
|
250 | + ConstraintsServices::getDelegatingConstraintChecker($services) |
|
251 | 251 | ); |
252 | 252 | |
253 | 253 | $cacheCheckConstraintsResults = false; |
254 | 254 | |
255 | - if ( $config->get( 'WBQualityConstraintsCacheCheckConstraintsResults' ) ) { |
|
255 | + if ($config->get('WBQualityConstraintsCacheCheckConstraintsResults')) { |
|
256 | 256 | $cacheCheckConstraintsResults = true; |
257 | 257 | // check that we can use getLocalRepoWikiPageMetaDataAccessor() |
258 | 258 | // TODO we should always be able to cache constraint check results (T244726) |
259 | - $entitySources = WikibaseRepo::getEntitySourceDefinitions( $services )->getSources(); |
|
260 | - $localEntitySourceName = WikibaseRepo::getLocalEntitySource( $services )->getSourceName(); |
|
259 | + $entitySources = WikibaseRepo::getEntitySourceDefinitions($services)->getSources(); |
|
260 | + $localEntitySourceName = WikibaseRepo::getLocalEntitySource($services)->getSourceName(); |
|
261 | 261 | |
262 | - foreach ( $entitySources as $entitySource ) { |
|
263 | - if ( $entitySource->getSourceName() !== $localEntitySourceName ) { |
|
264 | - LoggerFactory::getInstance( 'WikibaseQualityConstraints' )->warning( |
|
265 | - 'Cannot cache constraint check results for non-local source: ' . |
|
262 | + foreach ($entitySources as $entitySource) { |
|
263 | + if ($entitySource->getSourceName() !== $localEntitySourceName) { |
|
264 | + LoggerFactory::getInstance('WikibaseQualityConstraints')->warning( |
|
265 | + 'Cannot cache constraint check results for non-local source: '. |
|
266 | 266 | $entitySource->getSourceName() |
267 | 267 | ); |
268 | 268 | $cacheCheckConstraintsResults = false; |
@@ -271,28 +271,28 @@ discard block |
||
271 | 271 | } |
272 | 272 | } |
273 | 273 | |
274 | - if ( $cacheCheckConstraintsResults ) { |
|
274 | + if ($cacheCheckConstraintsResults) { |
|
275 | 275 | $possiblyStaleConstraintTypes = [ |
276 | - $config->get( 'WBQualityConstraintsCommonsLinkConstraintId' ), |
|
277 | - $config->get( 'WBQualityConstraintsTypeConstraintId' ), |
|
278 | - $config->get( 'WBQualityConstraintsValueTypeConstraintId' ), |
|
279 | - $config->get( 'WBQualityConstraintsDistinctValuesConstraintId' ), |
|
276 | + $config->get('WBQualityConstraintsCommonsLinkConstraintId'), |
|
277 | + $config->get('WBQualityConstraintsTypeConstraintId'), |
|
278 | + $config->get('WBQualityConstraintsValueTypeConstraintId'), |
|
279 | + $config->get('WBQualityConstraintsDistinctValuesConstraintId'), |
|
280 | 280 | ]; |
281 | - $entityIdParser = WikibaseRepo::getEntityIdParser( $services ); |
|
281 | + $entityIdParser = WikibaseRepo::getEntityIdParser($services); |
|
282 | 282 | $wikiPageEntityMetaDataAccessor = WikibaseRepo::getLocalRepoWikiPageMetaDataAccessor( |
283 | 283 | $services ); |
284 | 284 | |
285 | 285 | $resultsSource = new CachingResultsSource( |
286 | 286 | $resultsSource, |
287 | 287 | ResultsCache::getDefaultInstance(), |
288 | - ConstraintsServices::getCheckResultSerializer( $services ), |
|
289 | - ConstraintsServices::getCheckResultDeserializer( $services ), |
|
288 | + ConstraintsServices::getCheckResultSerializer($services), |
|
289 | + ConstraintsServices::getCheckResultDeserializer($services), |
|
290 | 290 | $wikiPageEntityMetaDataAccessor, |
291 | 291 | $entityIdParser, |
292 | - $config->get( 'WBQualityConstraintsCacheCheckConstraintsTTLSeconds' ), |
|
292 | + $config->get('WBQualityConstraintsCacheCheckConstraintsTTLSeconds'), |
|
293 | 293 | $possiblyStaleConstraintTypes, |
294 | - $config->get( 'WBQualityConstraintsCacheCheckConstraintsMaximumRevisionIds' ), |
|
295 | - ConstraintsServices::getLoggingHelper( $services ) |
|
294 | + $config->get('WBQualityConstraintsCacheCheckConstraintsMaximumRevisionIds'), |
|
295 | + ConstraintsServices::getLoggingHelper($services) |
|
296 | 296 | ); |
297 | 297 | } |
298 | 298 |