Spamfilter configuration is not updated when changing the policy through API
Summary
When updating a spam policy through the API with mail_policy_update, there is no trigger to update the config files that are based on this policy.
Steps to reproduce
- Send POST request to remote/json.php?mail_policy_update
Correct behaviour
The configuration should be updated. This does happen when making a change to the policy through the UI:
function onAfterDatalogSave($insert = false) {
global $app;
if(!$insert && $this->record_has_changed){
$spamfilter_users = $app->db->queryAllRecords("SELECT * FROM spamfilter_users WHERE policy_id = ?", intval($this->id));
if(is_array($spamfilter_users) && !empty($spamfilter_users)){
foreach($spamfilter_users as $spamfilter_user){
$app->db->datalogUpdate('spamfilter_users', $spamfilter_user, 'id', $spamfilter_user["id"], true);
// check if this is an email domain
if(substr($spamfilter_user['email'],0,1) == '@') {
$domain = substr($spamfilter_user['email'],1);
// Nothing special to do for a domain
}
}
}
}
}
Environment
ISPConfig version: 3.2.11