@@ -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 | EntityLookup $entityLookup, |
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,15 +144,15 @@ 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 ); |
|
148 | - $this->constraintRepo->deleteForPropertyWhereConstraintIdIsStatementId( $propertyId ); |
|
147 | + $propertyId = new PropertyId($this->propertyId); |
|
148 | + $this->constraintRepo->deleteForPropertyWhereConstraintIdIsStatementId($propertyId); |
|
149 | 149 | |
150 | 150 | /** @var Property $property */ |
151 | - $property = $this->entityLookup->getEntity( $propertyId ); |
|
151 | + $property = $this->entityLookup->getEntity($propertyId); |
|
152 | 152 | $this->importConstraintsForProperty( |
153 | 153 | $property, |
154 | 154 | $this->constraintRepo, |
155 | - new PropertyId( $this->config->get( 'WBQualityConstraintsPropertyConstraintId' ) ) |
|
155 | + new PropertyId($this->config->get('WBQualityConstraintsPropertyConstraintId')) |
|
156 | 156 | ); |
157 | 157 | |
158 | 158 | return true; |
@@ -23,7 +23,7 @@ |
||
23 | 23 | */ |
24 | 24 | protected $snak; |
25 | 25 | |
26 | - public function __construct( EntityDocument $entity, Snak $snak ) { |
|
26 | + public function __construct(EntityDocument $entity, Snak $snak) { |
|
27 | 27 | $this->entity = $entity; |
28 | 28 | $this->snak = $snak; |
29 | 29 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | Statement $statement, |
24 | 24 | Snak $snak |
25 | 25 | ) { |
26 | - parent::__construct( $entity, $snak ); |
|
26 | + parent::__construct($entity, $snak); |
|
27 | 27 | $this->statement = $statement; |
28 | 28 | } |
29 | 29 | |
@@ -33,10 +33,10 @@ discard block |
||
33 | 33 | |
34 | 34 | public function getSnakGroup() { |
35 | 35 | $snaks = $this->statement->getQualifiers(); |
36 | - return array_values( $snaks->getArrayCopy() ); |
|
36 | + return array_values($snaks->getArrayCopy()); |
|
37 | 37 | } |
38 | 38 | |
39 | - protected function &getMainArray( array &$container ) { |
|
39 | + protected function &getMainArray(array &$container) { |
|
40 | 40 | $statementArray = &$this->getStatementArray( |
41 | 41 | $container, |
42 | 42 | $this->entity->getId()->getSerialization(), |
@@ -44,25 +44,25 @@ discard block |
||
44 | 44 | $this->statement->getGuid() |
45 | 45 | ); |
46 | 46 | |
47 | - if ( !array_key_exists( 'qualifiers', $statementArray ) ) { |
|
47 | + if (!array_key_exists('qualifiers', $statementArray)) { |
|
48 | 48 | $statementArray['qualifiers'] = []; |
49 | 49 | } |
50 | 50 | $qualifiersArray = &$statementArray['qualifiers']; |
51 | 51 | |
52 | 52 | $propertyId = $this->getSnak()->getPropertyId()->getSerialization(); |
53 | - if ( !array_key_exists( $propertyId, $qualifiersArray ) ) { |
|
53 | + if (!array_key_exists($propertyId, $qualifiersArray)) { |
|
54 | 54 | $qualifiersArray[$propertyId] = []; |
55 | 55 | } |
56 | 56 | $propertyArray = &$qualifiersArray[$propertyId]; |
57 | 57 | |
58 | - foreach ( $propertyArray as &$potentialQualifierArray ) { |
|
59 | - if ( $potentialQualifierArray['hash'] === $this->getSnak()->getHash() ) { |
|
58 | + foreach ($propertyArray as &$potentialQualifierArray) { |
|
59 | + if ($potentialQualifierArray['hash'] === $this->getSnak()->getHash()) { |
|
60 | 60 | $qualifierArray = &$potentialQualifierArray; |
61 | 61 | break; |
62 | 62 | } |
63 | 63 | } |
64 | - if ( !isset( $qualifierArray ) ) { |
|
65 | - $qualifierArray = [ 'hash' => $this->getSnak()->getHash() ]; |
|
64 | + if (!isset($qualifierArray)) { |
|
65 | + $qualifierArray = ['hash' => $this->getSnak()->getHash()]; |
|
66 | 66 | $propertyArray[] = &$qualifierArray; |
67 | 67 | } |
68 | 68 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | Reference $reference, |
31 | 31 | Snak $snak |
32 | 32 | ) { |
33 | - parent::__construct( $entity, $snak ); |
|
33 | + parent::__construct($entity, $snak); |
|
34 | 34 | $this->statement = $statement; |
35 | 35 | $this->reference = $reference; |
36 | 36 | } |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | |
42 | 42 | public function getSnakGroup() { |
43 | 43 | $snaks = $this->reference->getSnaks(); |
44 | - return array_values( $snaks->getArrayCopy() ); |
|
44 | + return array_values($snaks->getArrayCopy()); |
|
45 | 45 | } |
46 | 46 | |
47 | - protected function &getMainArray( array &$container ) { |
|
47 | + protected function &getMainArray(array &$container) { |
|
48 | 48 | $statementArray = &$this->getStatementArray( |
49 | 49 | $container, |
50 | 50 | $this->entity->getId()->getSerialization(), |
@@ -52,38 +52,38 @@ discard block |
||
52 | 52 | $this->statement->getGuid() |
53 | 53 | ); |
54 | 54 | |
55 | - if ( !array_key_exists( 'references', $statementArray ) ) { |
|
55 | + if (!array_key_exists('references', $statementArray)) { |
|
56 | 56 | $statementArray['references'] = []; |
57 | 57 | } |
58 | 58 | $referencesArray = &$statementArray['references']; |
59 | 59 | |
60 | - foreach ( $referencesArray as &$potentialReferenceArray ) { |
|
61 | - if ( $potentialReferenceArray['hash'] === $this->reference->getHash() ) { |
|
60 | + foreach ($referencesArray as &$potentialReferenceArray) { |
|
61 | + if ($potentialReferenceArray['hash'] === $this->reference->getHash()) { |
|
62 | 62 | $referenceArray = &$potentialReferenceArray; |
63 | 63 | break; |
64 | 64 | } |
65 | 65 | } |
66 | - if ( !isset( $referenceArray ) ) { |
|
67 | - $referenceArray = [ 'hash' => $this->reference->getHash(), 'snaks' => [] ]; |
|
66 | + if (!isset($referenceArray)) { |
|
67 | + $referenceArray = ['hash' => $this->reference->getHash(), 'snaks' => []]; |
|
68 | 68 | $referencesArray[] = &$referenceArray; |
69 | 69 | } |
70 | 70 | |
71 | 71 | $snaksArray = &$referenceArray['snaks']; |
72 | 72 | |
73 | 73 | $propertyId = $this->getSnak()->getPropertyId()->getSerialization(); |
74 | - if ( !array_key_exists( $propertyId, $snaksArray ) ) { |
|
74 | + if (!array_key_exists($propertyId, $snaksArray)) { |
|
75 | 75 | $snaksArray[$propertyId] = []; |
76 | 76 | } |
77 | 77 | $propertyArray = &$snaksArray[$propertyId]; |
78 | 78 | |
79 | - foreach ( $propertyArray as &$potentialSnakArray ) { |
|
80 | - if ( $potentialSnakArray['hash'] === $this->getSnak()->getHash() ) { |
|
79 | + foreach ($propertyArray as &$potentialSnakArray) { |
|
80 | + if ($potentialSnakArray['hash'] === $this->getSnak()->getHash()) { |
|
81 | 81 | $snakArray = &$potentialSnakArray; |
82 | 82 | break; |
83 | 83 | } |
84 | 84 | } |
85 | - if ( !isset( $snakArray ) ) { |
|
86 | - $snakArray = [ 'hash' => $this->getSnak()->getHash() ]; |
|
85 | + if (!isset($snakArray)) { |
|
86 | + $snakArray = ['hash' => $this->getSnak()->getHash()]; |
|
87 | 87 | $propertyArray[] = &$snakArray; |
88 | 88 | } |
89 | 89 |
@@ -20,9 +20,9 @@ discard block |
||
20 | 20 | */ |
21 | 21 | private $statement; |
22 | 22 | |
23 | - public function __construct( EntityDocument $entity, Statement $statement ) { |
|
24 | - Assert::parameterType( StatementListProvider::class, $entity, '$entity' ); |
|
25 | - parent::__construct( $entity, $statement->getMainSnak() ); |
|
23 | + public function __construct(EntityDocument $entity, Statement $statement) { |
|
24 | + Assert::parameterType(StatementListProvider::class, $entity, '$entity'); |
|
25 | + parent::__construct($entity, $statement->getMainSnak()); |
|
26 | 26 | |
27 | 27 | $this->statement = $statement; |
28 | 28 | } |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | /** @var StatementList $statements */ |
44 | 44 | $statements = $this->entity->getStatements(); |
45 | 45 | return $statements |
46 | - ->getByRank( [ Statement::RANK_NORMAL, Statement::RANK_PREFERRED ] ) |
|
46 | + ->getByRank([Statement::RANK_NORMAL, Statement::RANK_PREFERRED]) |
|
47 | 47 | ->getMainSnaks(); |
48 | 48 | } |
49 | 49 | |
50 | - protected function &getMainArray( array &$container ) { |
|
50 | + protected function &getMainArray(array &$container) { |
|
51 | 51 | $statementArray = &$this->getStatementArray( |
52 | 52 | $container, |
53 | 53 | $this->entity->getId()->getSerialization(), |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | $this->statement->getGuid() |
56 | 56 | ); |
57 | 57 | |
58 | - if ( !array_key_exists( 'mainsnak', $statementArray ) ) { |
|
59 | - $statementArray['mainsnak'] = [ 'hash' => $this->statement->getMainSnak()->getHash() ]; |
|
58 | + if (!array_key_exists('mainsnak', $statementArray)) { |
|
59 | + $statementArray['mainsnak'] = ['hash' => $this->statement->getMainSnak()->getHash()]; |
|
60 | 60 | } |
61 | 61 | $mainsnakArray = &$statementArray['mainsnak']; |
62 | 62 |
@@ -20,13 +20,13 @@ |
||
20 | 20 | * @param PropertyId $propertyId |
21 | 21 | * @return int |
22 | 22 | */ |
23 | - public function getPropertyCount( array $snaks, PropertyId $propertyId ) { |
|
24 | - return count( array_filter( |
|
23 | + public function getPropertyCount(array $snaks, PropertyId $propertyId) { |
|
24 | + return count(array_filter( |
|
25 | 25 | $snaks, |
26 | - function ( Snak $snak ) use ( $propertyId ) { |
|
27 | - return $snak->getPropertyId()->equals( $propertyId ); |
|
26 | + function(Snak $snak) use ($propertyId) { |
|
27 | + return $snak->getPropertyId()->equals($propertyId); |
|
28 | 28 | } |
29 | - ) ); |
|
29 | + )); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | } |
@@ -19,10 +19,10 @@ discard block |
||
19 | 19 | private $cache; |
20 | 20 | |
21 | 21 | public static function getDefaultInstance() { |
22 | - return new self( MediaWikiServices::getInstance()->getMainWANObjectCache() ); |
|
22 | + return new self(MediaWikiServices::getInstance()->getMainWANObjectCache()); |
|
23 | 23 | } |
24 | 24 | |
25 | - public function __construct( WANObjectCache $cache ) { |
|
25 | + public function __construct(WANObjectCache $cache) { |
|
26 | 26 | $this->cache = $cache; |
27 | 27 | } |
28 | 28 | |
@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | * @param string|null $languageCode defaults to user language |
32 | 32 | * @return string cache key |
33 | 33 | */ |
34 | - public function makeKey( EntityId $entityId, $languageCode = null ) { |
|
34 | + public function makeKey(EntityId $entityId, $languageCode = null) { |
|
35 | 35 | global $wgLang, $wgContLang; |
36 | - if ( $languageCode === null ) { |
|
36 | + if ($languageCode === null) { |
|
37 | 37 | $languageCode = $wgLang->getCode(); |
38 | 38 | } |
39 | - if ( !Language::isKnownLanguageTag( $languageCode ) && $languageCode !== 'qqx' ) { |
|
39 | + if (!Language::isKnownLanguageTag($languageCode) && $languageCode !== 'qqx') { |
|
40 | 40 | $languageCode = $wgContLang->getCode(); |
41 | 41 | } |
42 | 42 | return $this->cache->makeKey( |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | * @param float &$asOf |
56 | 56 | * @return mixed |
57 | 57 | */ |
58 | - public function get( EntityId $key, &$curTTL = null, array $checkKeys = [], &$asOf = null ) { |
|
59 | - return $this->cache->get( $this->makeKey( $key ), $curTTL, $checkKeys, $asOf ); |
|
58 | + public function get(EntityId $key, &$curTTL = null, array $checkKeys = [], &$asOf = null) { |
|
59 | + return $this->cache->get($this->makeKey($key), $curTTL, $checkKeys, $asOf); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -66,20 +66,20 @@ discard block |
||
66 | 66 | * @param array $opts |
67 | 67 | * @return bool |
68 | 68 | */ |
69 | - public function set( EntityId $key, $value, $ttl = 0, array $opts = [] ) { |
|
70 | - return $this->cache->set( $this->makeKey( $key ), $value, $ttl, $opts ); |
|
69 | + public function set(EntityId $key, $value, $ttl = 0, array $opts = []) { |
|
70 | + return $this->cache->set($this->makeKey($key), $value, $ttl, $opts); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
74 | 74 | * @param EntityId $key |
75 | 75 | * @return bool |
76 | 76 | */ |
77 | - public function delete( EntityId $key ) { |
|
77 | + public function delete(EntityId $key) { |
|
78 | 78 | $ok = true; |
79 | - $languageCodes = array_keys( Language::fetchLanguageNames( null, 'all' ) ); |
|
79 | + $languageCodes = array_keys(Language::fetchLanguageNames(null, 'all')); |
|
80 | 80 | $languageCodes[] = 'qqx'; |
81 | - foreach ( $languageCodes as $languageCode ) { |
|
82 | - $ok = $this->cache->delete( $this->makeKey( $key, $languageCode ) ) && $ok; |
|
81 | + foreach ($languageCodes as $languageCode) { |
|
82 | + $ok = $this->cache->delete($this->makeKey($key, $languageCode)) && $ok; |
|
83 | 83 | } |
84 | 84 | return $ok; |
85 | 85 | } |
@@ -9,10 +9,10 @@ discard block |
||
9 | 9 | use Wikibase\Repo\WikibaseRepo; |
10 | 10 | |
11 | 11 | // @codeCoverageIgnoreStart |
12 | -$basePath = getenv( "MW_INSTALL_PATH" ) !== false |
|
13 | - ? getenv( "MW_INSTALL_PATH" ) : __DIR__ . "/../../.."; |
|
12 | +$basePath = getenv("MW_INSTALL_PATH") !== false |
|
13 | + ? getenv("MW_INSTALL_PATH") : __DIR__."/../../.."; |
|
14 | 14 | |
15 | -require_once $basePath . "/maintenance/Maintenance.php"; |
|
15 | +require_once $basePath."/maintenance/Maintenance.php"; |
|
16 | 16 | // @codeCoverageIgnoreEnd |
17 | 17 | |
18 | 18 | /** |
@@ -38,31 +38,31 @@ discard block |
||
38 | 38 | parent::__construct(); |
39 | 39 | $repo = WikibaseRepo::getDefaultInstance(); |
40 | 40 | $this->propertyInfoLookup = $repo->getStore()->getPropertyInfoLookup(); |
41 | - $this->newUpdateConstraintsTableJob = function ( $propertyIdSerialization ) { |
|
41 | + $this->newUpdateConstraintsTableJob = function($propertyIdSerialization) { |
|
42 | 42 | return UpdateConstraintsTableJob::newFromGlobalState( |
43 | 43 | Title::newMainPage(), |
44 | - [ 'propertyId' => $propertyIdSerialization ] |
|
44 | + ['propertyId' => $propertyIdSerialization] |
|
45 | 45 | ); |
46 | 46 | }; |
47 | 47 | |
48 | - $this->addDescription( 'Imports property constraints from statements on properties' ); |
|
49 | - $this->requireExtension( 'WikibaseQualityConstraints' ); |
|
48 | + $this->addDescription('Imports property constraints from statements on properties'); |
|
49 | + $this->requireExtension('WikibaseQualityConstraints'); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | public function execute() { |
53 | - if ( !$this->getConfig()->get( 'WBQualityConstraintsEnableConstraintsImportFromStatements' ) ) { |
|
54 | - $this->error( 'Constraint statements are not enabled. Aborting.' ); |
|
53 | + if (!$this->getConfig()->get('WBQualityConstraintsEnableConstraintsImportFromStatements')) { |
|
54 | + $this->error('Constraint statements are not enabled. Aborting.'); |
|
55 | 55 | return; |
56 | 56 | } |
57 | 57 | |
58 | - foreach ( $this->propertyInfoLookup->getAllPropertyInfo() as $propertyIdSerialization => $info ) { |
|
59 | - $this->output( sprintf( 'Importing constraint statements for % 6s... ', $propertyIdSerialization ), $propertyIdSerialization ); |
|
60 | - $startTime = microtime( true ); |
|
61 | - $job = call_user_func( $this->newUpdateConstraintsTableJob, $propertyIdSerialization ); |
|
58 | + foreach ($this->propertyInfoLookup->getAllPropertyInfo() as $propertyIdSerialization => $info) { |
|
59 | + $this->output(sprintf('Importing constraint statements for % 6s... ', $propertyIdSerialization), $propertyIdSerialization); |
|
60 | + $startTime = microtime(true); |
|
61 | + $job = call_user_func($this->newUpdateConstraintsTableJob, $propertyIdSerialization); |
|
62 | 62 | $job->run(); |
63 | - $endTime = microtime( true ); |
|
64 | - $millis = ( $endTime - $startTime ) * 1000; |
|
65 | - $this->output( sprintf( 'done in % 6.2f ms.', $millis ), $propertyIdSerialization ); |
|
63 | + $endTime = microtime(true); |
|
64 | + $millis = ($endTime - $startTime) * 1000; |
|
65 | + $this->output(sprintf('done in % 6.2f ms.', $millis), $propertyIdSerialization); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | $this->dataFactory = $dataFactory; |
47 | 47 | $this->logger = $logger; |
48 | 48 | $this->constraintCheckDurationLimits = [ |
49 | - 'info' => $config->get( 'WBQualityConstraintsCheckDurationInfoSeconds' ), |
|
50 | - 'warning' => $config->get( 'WBQualityConstraintsCheckDurationWarningSeconds' ), |
|
49 | + 'info' => $config->get('WBQualityConstraintsCheckDurationInfoSeconds'), |
|
50 | + 'warning' => $config->get('WBQualityConstraintsCheckDurationWarningSeconds'), |
|
51 | 51 | ]; |
52 | 52 | } |
53 | 53 | |
@@ -73,46 +73,46 @@ discard block |
||
73 | 73 | $durationSeconds, |
74 | 74 | $method |
75 | 75 | ) { |
76 | - $constraintCheckerClassShortName = substr( strrchr( $constraintCheckerClass, '\\' ), 1 ); |
|
76 | + $constraintCheckerClassShortName = substr(strrchr($constraintCheckerClass, '\\'), 1); |
|
77 | 77 | $constraintTypeItemId = $constraint->getConstraintTypeItemId(); |
78 | 78 | |
79 | 79 | $this->dataFactory->timing( |
80 | - 'wikibase.quality.constraints.check.timing.' . |
|
81 | - $constraintTypeItemId . '-' . |
|
80 | + 'wikibase.quality.constraints.check.timing.'. |
|
81 | + $constraintTypeItemId.'-'. |
|
82 | 82 | $constraintCheckerClassShortName, |
83 | 83 | $durationSeconds * 1000 |
84 | 84 | ); |
85 | 85 | |
86 | 86 | // find the longest limit (and associated log level) that the duration exceeds |
87 | - foreach ( $this->constraintCheckDurationLimits as $level => $limit ) { |
|
87 | + foreach ($this->constraintCheckDurationLimits as $level => $limit) { |
|
88 | 88 | if ( |
89 | 89 | // duration exceeds this limit |
90 | - isset( $limit ) && $durationSeconds > $limit && |
|
90 | + isset($limit) && $durationSeconds > $limit && |
|
91 | 91 | // this limit is longer than previous longest limit |
92 | - ( !isset( $limitSeconds ) || $limit > $limitSeconds ) |
|
92 | + (!isset($limitSeconds) || $limit > $limitSeconds) |
|
93 | 93 | ) { |
94 | 94 | $limitSeconds = $limit; |
95 | 95 | $logLevel = $level; |
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
99 | - if ( !isset( $limitSeconds ) ) { |
|
99 | + if (!isset($limitSeconds)) { |
|
100 | 100 | return; |
101 | 101 | } |
102 | - if ( $context->getType() !== Context::TYPE_STATEMENT ) { |
|
102 | + if ($context->getType() !== Context::TYPE_STATEMENT) { |
|
103 | 103 | // TODO log less details but still log something |
104 | 104 | return; |
105 | 105 | } |
106 | 106 | |
107 | 107 | $resultMessage = $result->getMessage(); |
108 | - if ( $resultMessage instanceof ViolationMessage ) { |
|
108 | + if ($resultMessage instanceof ViolationMessage) { |
|
109 | 109 | $resultMessage = $resultMessage->getMessageKey(); |
110 | 110 | } |
111 | 111 | |
112 | 112 | $this->logger->log( |
113 | 113 | $logLevel, |
114 | - 'Constraint check with {constraintCheckerClassShortName} ' . |
|
115 | - 'took longer than {limitSeconds} second(s) ' . |
|
114 | + 'Constraint check with {constraintCheckerClassShortName} '. |
|
115 | + 'took longer than {limitSeconds} second(s) '. |
|
116 | 116 | '(duration: {durationSeconds} seconds).', |
117 | 117 | [ |
118 | 118 | 'method' => $method, |