jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/385958 )
Change subject: Split some long lines in SparqlHelper
......................................................................
Split some long lines in SparqlHelper
They could also be shortened by extracting the common prefix into a
variable, but then it would no longer be possible to search for the full
key in the code.
Change-Id: I1c1982cdbe83b90fd2b14cf95048f473a0c98dc2
---
M includes/ConstraintCheck/Helper/SparqlHelper.php
1 file changed, 12 insertions(+), 6 deletions(-)
Approvals:
Aaron Schulz: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/ConstraintCheck/Helper/SparqlHelper.php
b/includes/ConstraintCheck/Helper/SparqlHelper.php
index cd1be46..89680c8 100644
--- a/includes/ConstraintCheck/Helper/SparqlHelper.php
+++ b/includes/ConstraintCheck/Helper/SparqlHelper.php
@@ -349,17 +349,21 @@
function( $cacheMapArray ) use ( $text, $regex,
$textHash, $cacheMapSize ) {
// Initialize the cache map if not set
if ( $cacheMapArray === false ) {
- $this->dataFactory->increment(
'wikibase.quality.constraints.regex.cache.refresh.init' );
+ $key =
'wikibase.quality.constraints.regex.cache.refresh.init';
+ $this->dataFactory->increment( $key );
return [];
}
- $this->dataFactory->increment(
'wikibase.quality.constraints.regex.cache.refresh' );
+ $key =
'wikibase.quality.constraints.regex.cache.refresh';
+ $this->dataFactory->increment( $key );
$cacheMap = MapCacheLRU::newFromArray(
$cacheMapArray, $cacheMapSize );
if ( $cacheMap->has( $textHash ) ) {
- $this->dataFactory->increment(
'wikibase.quality.constraints.regex.cache.refresh.hit' );
+ $key =
'wikibase.quality.constraints.regex.cache.refresh.hit';
+ $this->dataFactory->increment( $key );
$cacheMap->get( $textHash ); // ping
cache
} else {
- $this->dataFactory->increment(
'wikibase.quality.constraints.regex.cache.refresh.miss' );
+ $key =
'wikibase.quality.constraints.regex.cache.refresh.miss';
+ $this->dataFactory->increment( $key );
$cacheMap->set(
$textHash,
$this->matchesRegularExpressionWithSparql( $text, $regex ),
@@ -382,10 +386,12 @@
);
if ( isset( $cacheMapArray[$textHash] ) ) {
- $this->dataFactory->increment(
'wikibase.quality.constraints.regex.cache.hit' );
+ $key = 'wikibase.quality.constraints.regex.cache.hit';
+ $this->dataFactory->increment( $key );
return $cacheMapArray[$textHash];
} else {
- $this->dataFactory->increment(
'wikibase.quality.constraints.regex.cache.miss' );
+ $key = 'wikibase.quality.constraints.regex.cache.miss';
+ $this->dataFactory->increment( $key );
return $this->matchesRegularExpressionWithSparql(
$text, $regex );
}
}
--
To view, visit https://gerrit.wikimedia.org/r/385958
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I1c1982cdbe83b90fd2b14cf95048f473a0c98dc2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints
Gerrit-Branch: master
Gerrit-Owner: Lucas Werkmeister (WMDE) <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits