@@ -25,36 +25,36 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @return bool |
27 | 27 | */ |
28 | - public static function onCreateSchema( DatabaseUpdater $updater ) { |
|
29 | - $updater->addExtensionTable( 'wbqc_constraints', __DIR__ . '/../sql/create_wbqc_constraints.sql' ); |
|
28 | + public static function onCreateSchema(DatabaseUpdater $updater) { |
|
29 | + $updater->addExtensionTable('wbqc_constraints', __DIR__.'/../sql/create_wbqc_constraints.sql'); |
|
30 | 30 | return true; |
31 | 31 | } |
32 | 32 | |
33 | - public static function onWikibaseChange( Change $change ) { |
|
33 | + public static function onWikibaseChange(Change $change) { |
|
34 | 34 | $config = MediaWikiServices::getInstance()->getMainConfig(); |
35 | - if ( $config->get( 'WBQualityConstraintsEnableConstraintsImportFromStatements' ) && |
|
36 | - self::isConstraintStatementsChange( $config, $change ) |
|
35 | + if ($config->get('WBQualityConstraintsEnableConstraintsImportFromStatements') && |
|
36 | + self::isConstraintStatementsChange($config, $change) |
|
37 | 37 | ) { |
38 | 38 | /** @var EntityChange $change */ |
39 | 39 | $title = Title::newMainPage(); |
40 | - $params = [ 'propertyId' => $change->getEntityId()->getSerialization() ]; |
|
40 | + $params = ['propertyId' => $change->getEntityId()->getSerialization()]; |
|
41 | 41 | JobQueueGroup::singleton()->push( |
42 | - new JobSpecification( 'constraintsTableUpdate', $params, [], $title ) |
|
42 | + new JobSpecification('constraintsTableUpdate', $params, [], $title) |
|
43 | 43 | ); |
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
47 | - public static function isConstraintStatementsChange( Config $config, Change $change ) { |
|
48 | - if ( !( $change instanceof EntityChange ) || |
|
47 | + public static function isConstraintStatementsChange(Config $config, Change $change) { |
|
48 | + if (!($change instanceof EntityChange) || |
|
49 | 49 | $change->getAction() !== EntityChange::UPDATE || |
50 | - !( $change->getEntityId() instanceof PropertyId ) |
|
50 | + !($change->getEntityId() instanceof PropertyId) |
|
51 | 51 | ) { |
52 | 52 | return false; |
53 | 53 | } |
54 | 54 | |
55 | 55 | $info = $change->getInfo(); |
56 | 56 | |
57 | - if ( !array_key_exists( 'compactDiff', $info ) ) { |
|
57 | + if (!array_key_exists('compactDiff', $info)) { |
|
58 | 58 | // the non-compact diff ($info['diff']) does not contain statement diffs (T110996), |
59 | 59 | // so we only know that the change *might* affect the constraint statements |
60 | 60 | return true; |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | /** @var EntityDiffChangedAspects $aspects */ |
64 | 64 | $aspects = $info['compactDiff']; |
65 | 65 | |
66 | - $propertyConstraintId = $config->get( 'WBQualityConstraintsPropertyConstraintId' ); |
|
67 | - return in_array( $propertyConstraintId, $aspects->getStatementChanges() ); |
|
66 | + $propertyConstraintId = $config->get('WBQualityConstraintsPropertyConstraintId'); |
|
67 | + return in_array($propertyConstraintId, $aspects->getStatementChanges()); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | } |