[API] Make Solr API return data if Solr is enabled

This commit is contained in:
ntimo 2019-12-23 19:12:18 +01:00
parent 4f8fabd1cc
commit d65d6a3704
No known key found for this signature in database
GPG Key ID: 3AF3627FB0440D55

View File

@ -1153,16 +1153,19 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
echo json_encode($temp, JSON_UNESCAPED_SLASHES); echo json_encode($temp, JSON_UNESCAPED_SLASHES);
break; break;
case "solr": case "solr":
$solr_status = solr_status();
$solr_size = ($solr_status['status']['dovecot-fts']['index']['size']); $solr_size = ($solr_status['status']['dovecot-fts']['index']['size']);
$solr_documents = ($solr_status['status']['dovecot-fts']['index']['numDocs']); $solr_documents = ($solr_status['status']['dovecot-fts']['index']['numDocs']);
if (strtolower(getenv('SKIP_SOLR')) != 'n') { if (strtolower(getenv('SKIP_SOLR')) != 'n') {
$solr_status = false; $solr_enabled = false;
} else {
$solr_enabled = true;
} }
echo json_encode(array( echo json_encode(array(
'type' => 'info', 'type' => 'info',
'solr_enabled' => $solr_status, 'solr_enabled' => $solr_enabled,
'solr_size' => $solr_size, 'solr_size' => $solr_size,
'solr_documents' => $solr_documents 'solr_documents' => $solr_documents
)); ));