dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "rdbms: make resolveDomainID() use more consistent in LoadBalancer"
[lhc/web/wiklou.git]
/
includes
/
cache
/
GenderCache.php
diff --git
a/includes/cache/GenderCache.php
b/includes/cache/GenderCache.php
index
1ec39a5
..
eedc3c6
100644
(file)
--- a/
includes/cache/GenderCache.php
+++ b/
includes/cache/GenderCache.php
@@
-34,6
+34,13
@@
class GenderCache {
protected $misses = 0;
protected $missLimit = 1000;
protected $misses = 0;
protected $missLimit = 1000;
+ /** @var NamespaceInfo */
+ private $nsInfo;
+
+ public function __construct( NamespaceInfo $nsInfo = null ) {
+ $this->nsInfo = $nsInfo ?? MediaWikiServices::getInstance()->getNamespaceInfo();
+ }
+
/**
* @deprecated in 1.28 see MediaWikiServices::getInstance()->getGenderCache()
* @return GenderCache
/**
* @deprecated in 1.28 see MediaWikiServices::getInstance()->getGenderCache()
* @return GenderCache
@@
-97,7
+104,7
@@
class GenderCache {
public function doLinkBatch( $data, $caller = '' ) {
$users = [];
foreach ( $data as $ns => $pagenames ) {
public function doLinkBatch( $data, $caller = '' ) {
$users = [];
foreach ( $data as $ns => $pagenames ) {
- if ( !
MWNamespace::
hasGenderDistinction( $ns ) ) {
+ if ( !
$this->nsInfo->
hasGenderDistinction( $ns ) ) {
continue;
}
foreach ( array_keys( $pagenames ) as $username ) {
continue;
}
foreach ( array_keys( $pagenames ) as $username ) {
@@
-122,7
+129,7
@@
class GenderCache {
if ( !$titleObj ) {
continue;
}
if ( !$titleObj ) {
continue;
}
- if ( !
MWNamespace::
hasGenderDistinction( $titleObj->getNamespace() ) ) {
+ if ( !
$this->nsInfo->
hasGenderDistinction( $titleObj->getNamespace() ) ) {
continue;
}
$users[] = $titleObj->getText();
continue;
}
$users[] = $titleObj->getText();
@@
-171,7
+178,7
@@
class GenderCache {
$res = $dbr->select( $table, $fields, $conds, $comment, [], $joins );
foreach ( $res as $row ) {
$res = $dbr->select( $table, $fields, $conds, $comment, [], $joins );
foreach ( $res as $row ) {
- $this->cache[$row->user_name] = $row->up_value ?
$row->up_value
: $default;
+ $this->cache[$row->user_name] = $row->up_value ?: $default;
}
}
}
}