Chad has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/118383

Change subject: Simplify a little bit of logic in a few places
......................................................................

Simplify a little bit of logic in a few places

Change-Id: If52a8e6e648737c52f75173946a1f4cbe7e12e5a
---
M includes/ElasticsearchIntermediary.php
M includes/Searcher.php
2 files changed, 3 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch 
refs/changes/83/118383/1

diff --git a/includes/ElasticsearchIntermediary.php 
b/includes/ElasticsearchIntermediary.php
index 8802521..a753d97 100644
--- a/includes/ElasticsearchIntermediary.php
+++ b/includes/ElasticsearchIntermediary.php
@@ -27,7 +27,7 @@
         * @var string|null the name or ip of the user for which we're 
performing this search or null in the case of
         * requests kicked off by jobs
         */
-       private $user;
+       private $user = 'nobody';
        /**
         * @var float|null start time of current request or null if none is 
running
         */
@@ -55,8 +55,6 @@
        protected function __construct( $user, $slowSeconds ) {
                if ( $user ) {
                        $this->user = 'User:' . $user->getName(); // name is 
the ip address of anonymous users
-               } else {
-                       $this->user = 'nobody';
                }
                $this->slowMillis = round( 1000 * $slowSeconds );
        }
diff --git a/includes/Searcher.php b/includes/Searcher.php
index 65ce7e8..bd48b01 100644
--- a/includes/Searcher.php
+++ b/includes/Searcher.php
@@ -1233,9 +1233,8 @@
                static $defaultBoostTemplates = null;
                if ( $defaultBoostTemplates === null ) {
                        $source = wfMessage( 'cirrussearch-boost-templates' 
)->inContentLanguage();
-                       if( $source->isDisabled() ) {
-                               $defaultBoostTemplates = array();
-                       } else {
+                       $defaultBoostTemplates = array();
+                       if( !$source->isDisabled() ) {
                                $lines = explode( "\n", $source->plain() );
                                $lines = preg_replace( '/#.*$/', '', $lines ); 
// Remove comments
                                $lines = array_map( 'trim', $lines );          
// Remove extra spaces

-- 
To view, visit https://gerrit.wikimedia.org/r/118383
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If52a8e6e648737c52f75173946a1f4cbe7e12e5a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Chad <ch...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to