@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | |
27 | 27 | const BATCH_SIZE = 10; |
28 | 28 | |
29 | - public static function newFromGlobalState( Title $title, array $params ) { |
|
30 | - Assert::parameterType( 'string', $params['propertyId'], '$params["propertyId"]' ); |
|
29 | + public static function newFromGlobalState(Title $title, array $params) { |
|
30 | + Assert::parameterType('string', $params['propertyId'], '$params["propertyId"]'); |
|
31 | 31 | $repo = WikibaseRepo::getDefaultInstance(); |
32 | 32 | return new UpdateConstraintsTableJob( |
33 | 33 | $title, |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | EntityRevisionLookup $entityRevisionLookup, |
84 | 84 | Serializer $snakSerializer |
85 | 85 | ) { |
86 | - parent::__construct( 'constraintsTableUpdate', $title, $params ); |
|
86 | + parent::__construct('constraintsTableUpdate', $title, $params); |
|
87 | 87 | |
88 | 88 | $this->propertyId = $propertyId; |
89 | 89 | $this->config = $config; |
@@ -92,11 +92,11 @@ discard block |
||
92 | 92 | $this->snakSerializer = $snakSerializer; |
93 | 93 | } |
94 | 94 | |
95 | - public function extractParametersFromQualifiers( SnakList $qualifiers ) { |
|
95 | + public function extractParametersFromQualifiers(SnakList $qualifiers) { |
|
96 | 96 | $parameters = []; |
97 | - foreach ( $qualifiers as $qualifier ) { |
|
97 | + foreach ($qualifiers as $qualifier) { |
|
98 | 98 | $qualifierId = $qualifier->getPropertyId()->getSerialization(); |
99 | - $paramSerialization = $this->snakSerializer->serialize( $qualifier ); |
|
99 | + $paramSerialization = $this->snakSerializer->serialize($qualifier); |
|
100 | 100 | $parameters[$qualifierId][] = $paramSerialization; |
101 | 101 | } |
102 | 102 | return $parameters; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | ) { |
109 | 109 | $constraintId = $constraintStatement->getGuid(); |
110 | 110 | $constraintTypeQid = $constraintStatement->getMainSnak()->getDataValue()->getEntityId()->getSerialization(); |
111 | - $parameters = $this->extractParametersFromQualifiers( $constraintStatement->getQualifiers() ); |
|
111 | + $parameters = $this->extractParametersFromQualifiers($constraintStatement->getQualifiers()); |
|
112 | 112 | return new Constraint( |
113 | 113 | $constraintId, |
114 | 114 | $propertyId, |
@@ -123,17 +123,17 @@ discard block |
||
123 | 123 | PropertyId $propertyConstraintPropertyId |
124 | 124 | ) { |
125 | 125 | $constraintsStatements = $property->getStatements() |
126 | - ->getByPropertyId( $propertyConstraintPropertyId ) |
|
127 | - ->getByRank( [ Statement::RANK_PREFERRED, Statement::RANK_NORMAL ] ); |
|
126 | + ->getByPropertyId($propertyConstraintPropertyId) |
|
127 | + ->getByRank([Statement::RANK_PREFERRED, Statement::RANK_NORMAL]); |
|
128 | 128 | $constraints = []; |
129 | - foreach ( $constraintsStatements->getIterator() as $constraintStatement ) { |
|
130 | - $constraints[] = $this->extractConstraintFromStatement( $property->getId(), $constraintStatement ); |
|
131 | - if ( count( $constraints ) >= self::BATCH_SIZE ) { |
|
132 | - $constraintRepo->insertBatch( $constraints ); |
|
129 | + foreach ($constraintsStatements->getIterator() as $constraintStatement) { |
|
130 | + $constraints[] = $this->extractConstraintFromStatement($property->getId(), $constraintStatement); |
|
131 | + if (count($constraints) >= self::BATCH_SIZE) { |
|
132 | + $constraintRepo->insertBatch($constraints); |
|
133 | 133 | $constraints = []; |
134 | 134 | } |
135 | 135 | } |
136 | - $constraintRepo->insertBatch( $constraints ); |
|
136 | + $constraintRepo->insertBatch($constraints); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -144,21 +144,21 @@ discard block |
||
144 | 144 | public function run() { |
145 | 145 | // TODO in the future: only touch constraints affected by the edit (requires T163465) |
146 | 146 | |
147 | - $propertyId = new PropertyId( $this->propertyId ); |
|
147 | + $propertyId = new PropertyId($this->propertyId); |
|
148 | 148 | $propertyRevision = $this->entityRevisionLookup->getEntityRevision( |
149 | 149 | $propertyId, |
150 | 150 | 0, // latest |
151 | 151 | EntityRevisionLookup::LATEST_FROM_MASTER |
152 | 152 | ); |
153 | 153 | |
154 | - $this->constraintRepo->deleteForPropertyWhereConstraintIdIsStatementId( $propertyId ); |
|
154 | + $this->constraintRepo->deleteForPropertyWhereConstraintIdIsStatementId($propertyId); |
|
155 | 155 | |
156 | 156 | /** @var Property $property */ |
157 | 157 | $property = $propertyRevision->getEntity(); |
158 | 158 | $this->importConstraintsForProperty( |
159 | 159 | $property, |
160 | 160 | $this->constraintRepo, |
161 | - new PropertyId( $this->config->get( 'WBQualityConstraintsPropertyConstraintId' ) ) |
|
161 | + new PropertyId($this->config->get('WBQualityConstraintsPropertyConstraintId')) |
|
162 | 162 | ); |
163 | 163 | |
164 | 164 | return true; |