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

master
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
1 changed files with 5 additions and 2 deletions

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);
break;
case "solr":
$solr_status = solr_status();
$solr_size = ($solr_status['status']['dovecot-fts']['index']['size']);
$solr_documents = ($solr_status['status']['dovecot-fts']['index']['numDocs']);
if (strtolower(getenv('SKIP_SOLR')) != 'n') {
$solr_status = false;
$solr_enabled = false;
} else {
$solr_enabled = true;
}
echo json_encode(array(
'type' => 'info',
'solr_enabled' => $solr_status,
'solr_enabled' => $solr_enabled,
'solr_size' => $solr_size,
'solr_documents' => $solr_documents
));