]>
gitweb.michael.orlitzky.com - mailshears.git/blob - lib/prune/prune_dummy_runner.rb
1 require 'common/runner'
2 require 'prune/plugins/postfixadmin'
3 require 'rm/rm_dummy_runner'
5 # Dummy implementation of a {PruneRunner}. Its <tt>run()</tt> method will
6 # tell you what would have been pruned, but will not actually perform
13 # Pretend to prune unused domains and users. Some "what if"
14 # information will be output to stdout.
16 # The prune mode is the main application of the "dummy" runners,
17 # since it performs some computation outside of the plugins
18 # themselves. This lets the user know which users and domains would
19 # be removed and can help prevent mistakes or even find bugs in the
20 # prune code, if it looks like something will be removed that
23 # @param cfg [Configuration] the configuration options to pass to
24 # the *plugin* we're runnning.
26 # @param plugin [Class] plugin class that will do the pruning.
29 # We don't want to check the PostfixAdmin database against itself.
30 return if plugin
.class == PostfixadminPrune
32 pfa
= PostfixadminPrune
.new(cfg
)
34 db_users
= pfa
.list_users()
35 db_domains
= pfa
.list_domains()
37 leftovers
= plugin
.get_leftover_users(db_users
)
38 leftovers +
= plugin
.get_leftover_domains(db_domains
)
40 rm_dummy_runner
= RmDummyRunner
.new()
41 rm_dummy_runner
.run(cfg
, plugin
, *leftovers
)