X-Git-Url: http://gitweb.michael.orlitzky.com/?p=mailshears.git;a=blobdiff_plain;f=lib%2Fprune%2Fprune_dummy_runner.rb;h=6cb789fcee6c4243f7e4a819eaf55fc8f8102e76;hp=f9bde5e17c667b086f037a0232b054644d7ce292;hb=72696d3f6e95ef773af9727e9c3459b9038b0fc2;hpb=e3826d8926e11763837a591986d453e9ef5d9dec diff --git a/lib/prune/prune_dummy_runner.rb b/lib/prune/prune_dummy_runner.rb index f9bde5e..6cb789f 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_users(db_users) + leftover_domains = plugin.get_leftover_domains(db_domains) + + leftover_users.each do |user| + user_description = plugin.describe_user(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