Chad has uploaded a new change for review.

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

Change subject: Fix undefined offset in updateOneSearchIndexConfig
......................................................................

Fix undefined offset in updateOneSearchIndexConfig

isset( $wgCirrusSearchReplicas[ $this->indexType ] ) returns true
if $wgCirrusSearchReplicas is a string, so we need to also
check type of $wgCirrusSearchReplicas.

Bug: 72888
Change-Id: I1d8c13cbc2dd5a34b0e5b877a046d314fdefc236
(cherry picked from commit 96a1d2c9ce234879b283b67be0fc820d9378500d)
---
M maintenance/updateOneSearchIndexConfig.php
1 file changed, 7 insertions(+), 4 deletions(-)


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

diff --git a/maintenance/updateOneSearchIndexConfig.php 
b/maintenance/updateOneSearchIndexConfig.php
index f348dd9..6c22cbb 100644
--- a/maintenance/updateOneSearchIndexConfig.php
+++ b/maintenance/updateOneSearchIndexConfig.php
@@ -1021,13 +1021,16 @@
 
        private function getReplicaCount() {
                global $wgCirrusSearchReplicas;
+
                // If $wgCirrusSearchReplicas is an array of index type to 
number of replicas then respect that
-               if ( isset( $wgCirrusSearchReplicas[ $this->indexType ] ) ) {
-                       return $wgCirrusSearchReplicas[ $this->indexType ];
-               }
                if ( is_array( $wgCirrusSearchReplicas ) ) {
-                       $this->error( 'If wgCirrusSearchReplicas is an array it 
must contain all index types.', 1 );
+                       if ( isset( $wgCirrusSearchReplicas[ $this->indexType ] 
) ) {
+                               return $wgCirrusSearchReplicas[ 
$this->indexType ];
+                       } else {
+                               $this->error( 'If wgCirrusSearchReplicas is an 
array it must contain all index types.', 1 );
+                       }
                }
+
                // Otherwise its just a raw scalar so we should respect that too
                return $wgCirrusSearchReplicas;
        }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1d8c13cbc2dd5a34b0e5b877a046d314fdefc236
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: wmf/1.25wmf6
Gerrit-Owner: Chad <ch...@wikimedia.org>
Gerrit-Reviewer: Aude <aude.w...@gmail.com>

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

Reply via email to