smeserver-spamassassin/root/etc/e-smith/db/configuration/migrate/10spamassassin

47 lines
1.2 KiB
Plaintext

{
my $sa = $DB->get("spamassassin") or return;
my %old2new = (
required_hits => "TagLevel",
skip_rbl_checks => "SkipRBLChecks",
sort_spam => "SortSpam",
use_bayes => "UseBayes",
);
for my $key (keys %old2new)
{
next unless (exists $spamassassin{$key});
my $value = $DB->get_prop_and_delete('spamassassin', $key);
$DB->set_prop('spamassassin', $old2new{$key}, $value);
}
my $sortspam = $DB->get_prop('spamassassin', 'SortSpam');
if ($sortspam eq "0" or $sortspam eq "1")
{
$DB->set_prop('spamassassin', 'SortSpam',
($sortspam eq "1") ? "enabled" : "disabled");
}
my $value = $DB->get_prop_and_delete('spamassassin', 'rewrite_subject');
if (defined $value)
{
$DB->set_prop('spamassassin', 'SubjectTag',
($value ? 'enabled' : 'disabled'));
}
# migrate only interesting value from spamd and delete it
my $spamd = $DB->get("spamd");
if ($spamd){
my $SpamLearning = $DB->get_prop('spamassassin', 'SpamLearning') || "empty";
if ( exists $spamd{'SpamLearning'} && ! exists $spamassassin{'SpamLearning'} ) {
$DB->set_prop('spamassassin', 'SpamLearning', $spamd{'SpamLearning'});
}
$spamd->delete;
}
}