mirror of
https://github.com/mailcow/mailcow-dockerized.git
synced 2026-01-04 12:39:15 +00:00
dovecot: replace solr fts with flatcurve (xapian) (#5680)
* fts-flatcurve: inital implementation * fts: removed solr from compose.yml * flatcurve: added heap and proc logic to dovecot * added logic for update.sh & generate for Flatcurve * delete old iteration of fts-flatcurve.conf * updated default fts.conf * updated .gitignore to exclude fts.conf for further git updates * Remove autogeneration of fts.conf (disable override) * cleanup all left solr stuff * renamed SKIP_FLATCURVE to SKIP_FTS * cleanup leftovers solr in lang files * moved lazy_expunge plugin only to mail_plugins * added fts timeout value * compose: remove dev image of dovecot * updated japanese translation
This commit is contained in:
@@ -2908,50 +2908,6 @@ function getGUID() {
|
||||
.substr($charid,16, 4).$hyphen
|
||||
.substr($charid,20,12);
|
||||
}
|
||||
function solr_status() {
|
||||
$curl = curl_init();
|
||||
$endpoint = 'http://solr:8983/solr/admin/cores';
|
||||
$params = array(
|
||||
'action' => 'STATUS',
|
||||
'core' => 'dovecot-fts',
|
||||
'indexInfo' => 'true'
|
||||
);
|
||||
$url = $endpoint . '?' . http_build_query($params);
|
||||
curl_setopt($curl, CURLOPT_URL, $url);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($curl, CURLOPT_POST, 0);
|
||||
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
|
||||
$response_core = curl_exec($curl);
|
||||
if ($response_core === false) {
|
||||
$err = curl_error($curl);
|
||||
curl_close($curl);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
curl_close($curl);
|
||||
$curl = curl_init();
|
||||
$status_core = json_decode($response_core, true);
|
||||
$url = 'http://solr:8983/solr/admin/info/system';
|
||||
curl_setopt($curl, CURLOPT_URL, $url);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($curl, CURLOPT_POST, 0);
|
||||
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
|
||||
$response_sysinfo = curl_exec($curl);
|
||||
if ($response_sysinfo === false) {
|
||||
$err = curl_error($curl);
|
||||
curl_close($curl);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
curl_close($curl);
|
||||
$status_sysinfo = json_decode($response_sysinfo, true);
|
||||
$status = array_merge($status_core, $status_sysinfo);
|
||||
return (!empty($status['status']['dovecot-fts']) && !empty($status['jvm']['memory'])) ? $status : false;
|
||||
}
|
||||
return (!empty($status['status']['dovecot-fts'])) ? $status['status']['dovecot-fts'] : false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function cleanupJS($ignore = '', $folder = '/tmp/*.js') {
|
||||
$now = time();
|
||||
|
||||
@@ -5434,25 +5434,6 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
||||
'msg' => 'Could not move maildir to garbage collector: variables local_part and/or domain empty'
|
||||
);
|
||||
}
|
||||
if (strtolower(getenv('SKIP_SOLR')) == 'n' && strtolower(getenv('FLATCURVE_EXPERIMENTAL')) != 'y') {
|
||||
$curl = curl_init();
|
||||
curl_setopt($curl, CURLOPT_URL, 'http://solr:8983/solr/dovecot-fts/update?commit=true');
|
||||
curl_setopt($curl, CURLOPT_HTTPHEADER,array('Content-Type: text/xml'));
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($curl, CURLOPT_POST, 1);
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, '<delete><query>user:' . $username . '</query></delete>');
|
||||
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
|
||||
$response = curl_exec($curl);
|
||||
if ($response === false) {
|
||||
$err = curl_error($curl);
|
||||
$_SESSION['return'][] = array(
|
||||
'type' => 'warning',
|
||||
'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr),
|
||||
'msg' => 'Could not remove Solr index: ' . print_r($err, true)
|
||||
);
|
||||
}
|
||||
curl_close($curl);
|
||||
}
|
||||
$stmt = $pdo->prepare("DELETE FROM `alias` WHERE `goto` = :username");
|
||||
$stmt->execute(array(
|
||||
':username' => $username
|
||||
|
||||
Reference in New Issue
Block a user