jenkins-bot has submitted this change and it was merged.
Change subject: Null is a valid value in Searcher::$namespaces
......................................................................
Null is a valid value in Searcher::$namespaces
The namespaces variable is nullable, set by SearchEngine::replacePrefixes().
This indicates that all namespaces should be searched. Icd762939 introduced
type hints to CirrusSearch\Searcher::__construct which do not accept this
nullable value and causes exceptions. CirrusSearch appopriatly handles the null
case so mark it as such.
The replacement of false with array() looks to be safe, nothing checks for an
exact false boolean, only that the namespaces value itself is falsey. The value
is defaulted to null because thats the only way to tell php that null is an
allowed value when typehinted to array.
Bug: T98082
Change-Id: Ic0d6adcde305d9ed4ccd1edb0406080f616a393e
---
M includes/Dump.php
M includes/Maintenance/Validators/CacheWarmersValidator.php
M includes/Searcher.php
M maintenance/saneitize.php
4 files changed, 7 insertions(+), 7 deletions(-)
Approvals:
Manybubbles: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/Dump.php b/includes/Dump.php
index 58d5b65..44d4ace 100644
--- a/includes/Dump.php
+++ b/includes/Dump.php
@@ -31,7 +31,7 @@
$response = $this->getRequest()->response();
$response->header( 'Content-type: application/json;
charset=UTF-8' );
- $searcher = new Searcher( 0, 0, false, $this->getUser() );
+ $searcher = new Searcher( 0, 0, array(), $this->getUser() );
$id = $this->getTitle()->getArticleID();
$esSources = $searcher->get( array( $id ), true );
if ( !$esSources->isOk() ) {
diff --git a/includes/Maintenance/Validators/CacheWarmersValidator.php
b/includes/Maintenance/Validators/CacheWarmersValidator.php
index f7c36a0..42ab657 100644
--- a/includes/Maintenance/Validators/CacheWarmersValidator.php
+++ b/includes/Maintenance/Validators/CacheWarmersValidator.php
@@ -76,8 +76,8 @@
$searcher = new Searcher(
0, 50,
// 0 offset 50 limit is the default for searching so we
try it too.
- false,
- // false for namespaces will stop us from eagerly
caching the namespace
+ array(),
+ // array() for namespaces will stop us from eagerly
caching the namespace
// filters. That is probably OK because most searches
don't use one.
// It'd be overeager.
null
diff --git a/includes/Searcher.php b/includes/Searcher.php
index 7e14870..4d24aa7 100644
--- a/includes/Searcher.php
+++ b/includes/Searcher.php
@@ -69,7 +69,7 @@
private $limit;
/**
- * @var int[] array of namespaces in which to search
+ * @var int[]|null array of namespaces in which to search
*/
protected $namespaces;
@@ -200,11 +200,11 @@
* Constructor
* @param int $offset Offset the results by this much
* @param int $limit Limit the results to this many
- * @param int[] $namespaces Array of namespace numbers to search
+ * @param int[]|null $namespaces Array of namespace numbers to search
or null to search all namespaces.
* @param User|null $user user for which this search is being
performed. Attached to slow request logs.
* @param string|boolean $index Base name for index to search from,
defaults to wfWikiId()
*/
- public function __construct( $offset, $limit, array $namespaces, User
$user = null, $index = false ) {
+ public function __construct( $offset, $limit, array $namespaces = null,
User $user = null, $index = false ) {
global $wgCirrusSearchSlowSearch,
$wgLanguageCode,
$wgContLang;
diff --git a/maintenance/saneitize.php b/maintenance/saneitize.php
index 318783a..e24b75a 100644
--- a/maintenance/saneitize.php
+++ b/maintenance/saneitize.php
@@ -116,7 +116,7 @@
$this->remediator = new PrintingRemediator(
$this->remediator );
}
// This searcher searches all indexes for the current wiki.
- $searcher = new Searcher( 0, 0, false, null );
+ $searcher = new Searcher( 0, 0, array(), null );
$this->checker = new Checker( $this->remediator, $searcher,
$this->getOption( 'logSane' ) );
}
}
--
To view, visit https://gerrit.wikimedia.org/r/208827
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic0d6adcde305d9ed4ccd1edb0406080f616a393e
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: EBernhardson <[email protected]>
Gerrit-Reviewer: Manybubbles <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits