X-Git-Url: http://gitweb.michael.orlitzky.com/?p=mailshears.git;a=blobdiff_plain;f=lib%2Fprune%2Fprune_dummy_runner.rb;h=158ed5f005bef8ceefdfe6c5a0c4469137ddb510;hp=f9bde5e17c667b086f037a0232b054644d7ce292;hb=8064b7be68006d07889e2d24eb0bddc6063d3275;hpb=e3826d8926e11763837a591986d453e9ef5d9dec diff --git a/lib/prune/prune_dummy_runner.rb b/lib/prune/prune_dummy_runner.rb index f9bde5e..158ed5f 100644 --- a/lib/prune/prune_dummy_runner.rb +++ b/lib/prune/prune_dummy_runner.rb @@ -1,8 +1,33 @@ +require 'common/runner' + +# This is always needed, regardless of which plugin is running. +require 'prune/plugins/postfixadmin' + class PruneDummyRunner include Runner def run(plugin) - puts "Not implemented" + # We don't want to check the PostfixAdmin database against itself. + return if plugin.class == PostfixadminPrune + + cfg = Configuration.new() + pfa = PostfixadminPrune.new(cfg) + + db_users = pfa.list_users() + db_domains = pfa.list_domains() + + leftover_users = plugin.get_leftover_accounts(db_users) + leftover_domains = plugin.get_leftover_domains(db_domains) + + leftover_users.each do |user| + user_description = plugin.describe_account(user) + report(plugin, "Would remove user: #{user} (#{user_description})") + end + + leftover_domains.each do |domain| + domain_description = plugin.describe_domain(domain) + report(plugin, "Would remove domain: #{domain} (#{domain_description})") + end end end