1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 16:22:43 +01:00

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
This commit is contained in:
Valerio Bozzolan 2023-03-03 12:15:48 +01:00
parent 53c31b7b13
commit 66192a5b83

View file

@ -60,8 +60,20 @@ final class PhabricatorConfigClusterSearchController
foreach ($service->getHosts() as $host) { foreach ($service->getHosts() as $host) {
try { 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 = $host->getConnectionStatus();
$status = idx($status_map, $status, array()); $status = idx($status_map, $status, $default_status);
} catch (Exception $ex) { } catch (Exception $ex) {
$status['icon'] = 'fa-times'; $status['icon'] = 'fa-times';
$status['label'] = pht('Connection Error'); $status['label'] = pht('Connection Error');