@@ -28,48 +28,48 @@ discard block |
||
28 | 28 | /** |
29 | 29 | * @param DatabaseUpdater $updater |
30 | 30 | */ |
31 | - public static function onCreateSchema( DatabaseUpdater $updater ) { |
|
31 | + public static function onCreateSchema(DatabaseUpdater $updater) { |
|
32 | 32 | $updater->addExtensionTable( |
33 | 33 | 'wbqc_constraints', |
34 | - __DIR__ . '/../sql/create_wbqc_constraints.sql' |
|
34 | + __DIR__.'/../sql/create_wbqc_constraints.sql' |
|
35 | 35 | ); |
36 | 36 | $updater->addExtensionField( |
37 | 37 | 'wbqc_constraints', |
38 | 38 | 'constraint_id', |
39 | - __DIR__ . '/../sql/patch-wbqc_constraints-constraint_id.sql' |
|
39 | + __DIR__.'/../sql/patch-wbqc_constraints-constraint_id.sql' |
|
40 | 40 | ); |
41 | 41 | $updater->addExtensionIndex( |
42 | 42 | 'wbqc_constraints', |
43 | 43 | 'wbqc_constraints_guid_uniq', |
44 | - __DIR__ . '/../sql/patch-wbqc_constraints-wbqc_constraints_guid_uniq.sql' |
|
44 | + __DIR__.'/../sql/patch-wbqc_constraints-wbqc_constraints_guid_uniq.sql' |
|
45 | 45 | ); |
46 | 46 | } |
47 | 47 | |
48 | - public static function onWikibaseChange( Change $change ) { |
|
48 | + public static function onWikibaseChange(Change $change) { |
|
49 | 49 | $config = MediaWikiServices::getInstance()->getMainConfig(); |
50 | - if ( $config->get( 'WBQualityConstraintsEnableConstraintsImportFromStatements' ) && |
|
51 | - self::isConstraintStatementsChange( $config, $change ) |
|
50 | + if ($config->get('WBQualityConstraintsEnableConstraintsImportFromStatements') && |
|
51 | + self::isConstraintStatementsChange($config, $change) |
|
52 | 52 | ) { |
53 | 53 | /** @var EntityChange $change */ |
54 | 54 | $title = Title::newMainPage(); |
55 | - $params = [ 'propertyId' => $change->getEntityId()->getSerialization() ]; |
|
55 | + $params = ['propertyId' => $change->getEntityId()->getSerialization()]; |
|
56 | 56 | JobQueueGroup::singleton()->push( |
57 | - new JobSpecification( 'constraintsTableUpdate', $params, [], $title ) |
|
57 | + new JobSpecification('constraintsTableUpdate', $params, [], $title) |
|
58 | 58 | ); |
59 | 59 | } |
60 | 60 | } |
61 | 61 | |
62 | - public static function isConstraintStatementsChange( Config $config, Change $change ) { |
|
63 | - if ( !( $change instanceof EntityChange ) || |
|
62 | + public static function isConstraintStatementsChange(Config $config, Change $change) { |
|
63 | + if (!($change instanceof EntityChange) || |
|
64 | 64 | $change->getAction() !== EntityChange::UPDATE || |
65 | - !( $change->getEntityId() instanceof PropertyId ) |
|
65 | + !($change->getEntityId() instanceof PropertyId) |
|
66 | 66 | ) { |
67 | 67 | return false; |
68 | 68 | } |
69 | 69 | |
70 | 70 | $info = $change->getInfo(); |
71 | 71 | |
72 | - if ( !array_key_exists( 'compactDiff', $info ) ) { |
|
72 | + if (!array_key_exists('compactDiff', $info)) { |
|
73 | 73 | // the non-compact diff ($info['diff']) does not contain statement diffs (T110996), |
74 | 74 | // so we only know that the change *might* affect the constraint statements |
75 | 75 | return true; |
@@ -78,46 +78,46 @@ discard block |
||
78 | 78 | /** @var EntityDiffChangedAspects $aspects */ |
79 | 79 | $aspects = $info['compactDiff']; |
80 | 80 | |
81 | - $propertyConstraintId = $config->get( 'WBQualityConstraintsPropertyConstraintId' ); |
|
82 | - return in_array( $propertyConstraintId, $aspects->getStatementChanges() ); |
|
81 | + $propertyConstraintId = $config->get('WBQualityConstraintsPropertyConstraintId'); |
|
82 | + return in_array($propertyConstraintId, $aspects->getStatementChanges()); |
|
83 | 83 | } |
84 | 84 | |
85 | - public static function onArticlePurge( WikiPage $wikiPage ) { |
|
85 | + public static function onArticlePurge(WikiPage $wikiPage) { |
|
86 | 86 | $repo = WikibaseRepo::getDefaultInstance(); |
87 | 87 | |
88 | 88 | $entityContentFactory = $repo->getEntityContentFactory(); |
89 | - if ( $entityContentFactory->isEntityContentModel( $wikiPage->getContentModel() ) ) { |
|
90 | - $entityId = $entityContentFactory->getEntityIdForTitle( $wikiPage->getTitle() ); |
|
91 | - if ( $entityId !== null ) { |
|
89 | + if ($entityContentFactory->isEntityContentModel($wikiPage->getContentModel())) { |
|
90 | + $entityId = $entityContentFactory->getEntityIdForTitle($wikiPage->getTitle()); |
|
91 | + if ($entityId !== null) { |
|
92 | 92 | $resultsCache = ResultsCache::getDefaultInstance(); |
93 | - $resultsCache->delete( $entityId ); |
|
93 | + $resultsCache->delete($entityId); |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | } |
97 | 97 | |
98 | - public static function onBeforePageDisplay( OutputPage $out, Skin $skin ) { |
|
98 | + public static function onBeforePageDisplay(OutputPage $out, Skin $skin) { |
|
99 | 99 | $repo = WikibaseRepo::getDefaultInstance(); |
100 | 100 | |
101 | 101 | $lookup = $repo->getEntityNamespaceLookup(); |
102 | 102 | $title = $out->getTitle(); |
103 | - if ( $title === null ) { |
|
103 | + if ($title === null) { |
|
104 | 104 | return; |
105 | 105 | } |
106 | 106 | |
107 | - if ( !$lookup->isEntityNamespace( $title->getNamespace() ) ) { |
|
107 | + if (!$lookup->isEntityNamespace($title->getNamespace())) { |
|
108 | 108 | return; |
109 | 109 | } |
110 | - if ( empty( $out->getJsConfigVars()['wbIsEditView'] ) ) { |
|
110 | + if (empty($out->getJsConfigVars()['wbIsEditView'])) { |
|
111 | 111 | return; |
112 | 112 | } |
113 | 113 | |
114 | - $out->addModules( 'wikibase.quality.constraints.suggestions' ); |
|
114 | + $out->addModules('wikibase.quality.constraints.suggestions'); |
|
115 | 115 | |
116 | - if ( !$out->getUser()->isLoggedIn() ) { |
|
116 | + if (!$out->getUser()->isLoggedIn()) { |
|
117 | 117 | return; |
118 | 118 | } |
119 | 119 | |
120 | - $out->addModules( 'wikibase.quality.constraints.gadget' ); |
|
120 | + $out->addModules('wikibase.quality.constraints.gadget'); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -125,14 +125,14 @@ discard block |
||
125 | 125 | * @param array &$vars |
126 | 126 | * @param OutputPage $out |
127 | 127 | */ |
128 | - public static function addVariables( &$vars, OutputPage $out ) { |
|
128 | + public static function addVariables(&$vars, OutputPage $out) { |
|
129 | 129 | $config = MediaWikiServices::getInstance()->getMainConfig(); |
130 | 130 | |
131 | - $vars['wbQualityConstraintsPropertyConstraintId'] = $config->get( 'WBQualityConstraintsPropertyConstraintId' ); |
|
132 | - $vars['wbQualityConstraintsOneOfConstraintId'] = $config->get( 'WBQualityConstraintsOneOfConstraintId' ); |
|
133 | - $vars['wbQualityConstraintsAllowedQualifierConstraintId'] = $config->get( 'WBQualityConstraintsAllowedQualifiersConstraintId' ); |
|
134 | - $vars['wbQualityConstraintsPropertyId'] = $config->get( 'WBQualityConstraintsPropertyId' ); |
|
135 | - $vars['wbQualityConstraintsQualifierOfPropertyConstraintId'] = $config->get( 'WBQualityConstraintsQualifierOfPropertyConstraintId' ); |
|
131 | + $vars['wbQualityConstraintsPropertyConstraintId'] = $config->get('WBQualityConstraintsPropertyConstraintId'); |
|
132 | + $vars['wbQualityConstraintsOneOfConstraintId'] = $config->get('WBQualityConstraintsOneOfConstraintId'); |
|
133 | + $vars['wbQualityConstraintsAllowedQualifierConstraintId'] = $config->get('WBQualityConstraintsAllowedQualifiersConstraintId'); |
|
134 | + $vars['wbQualityConstraintsPropertyId'] = $config->get('WBQualityConstraintsPropertyId'); |
|
135 | + $vars['wbQualityConstraintsQualifierOfPropertyConstraintId'] = $config->get('WBQualityConstraintsQualifierOfPropertyConstraintId'); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | } |