From 66192a5b832cff2856809736ab6e4696595a0934 Mon Sep 17 00:00:00 2001 From: Valerio Bozzolan Date: Fri, 3 Mar 2023 12:15:48 +0100 Subject: [PATCH] Fix "Undefined index: icon" when visiting Search Servers using MySQL Summary: Fix "Undefined index: icon" when visiting Search Servers using MySQL NOTE: This patch just fixes the exception at my best but this section probably deserves more improvement to show a better default. Closes T15155 Test Plan: - use the default Search Server configuration (that is MySQL) - open the page Search Servers (/config/cluster/search/) - verify that it does not explode anymore but it displays something unuseful Reviewers: O1 Blessed Committers, avivey Reviewed By: O1 Blessed Committers, avivey Subscribers: avivey, speck, tobiaswiese, Matthew, Cigaryno Maniphest Tasks: T15155 Differential Revision: https://we.phorge.it/D25070 --- .../PhabricatorConfigClusterSearchController.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/applications/config/controller/services/PhabricatorConfigClusterSearchController.php b/src/applications/config/controller/services/PhabricatorConfigClusterSearchController.php index 5e877d6b95..706d6b4fa9 100644 --- a/src/applications/config/controller/services/PhabricatorConfigClusterSearchController.php +++ b/src/applications/config/controller/services/PhabricatorConfigClusterSearchController.php @@ -60,8 +60,20 @@ final class PhabricatorConfigClusterSearchController foreach ($service->getHosts() as $host) { try { + // Default status icon + // + // At the moment the default status is shown also when + // you just use MySQL as search server. So, on MySQL it + // shows "Unknown" even if probably it should says "Active". + // If you have time, please improve the MySQL getConnectionStatus() + // to return something more useful than this default. + $default_status = array( + 'icon' => 'fa-question-circle', + 'color' => 'blue', + 'label' => pht('Unknown'), + ); $status = $host->getConnectionStatus(); - $status = idx($status_map, $status, array()); + $status = idx($status_map, $status, $default_status); } catch (Exception $ex) { $status['icon'] = 'fa-times'; $status['label'] = pht('Connection Error');