]>
gitweb.michael.orlitzky.com - mailshears.git/blob - lib/prune/plugins/davical.rb
ae21d9f186a859309fc58584e7d8d010c490b926
3 require 'common/davical_plugin'
4 require 'prune/prune_plugin'
5 require 'rm/plugins/davical'
7 class DavicalPrune
< DavicalRm
9 # DAViCal only supports Postgres, so even if we ever are
10 # database-agnostic, this plugin can't be.
16 def get_leftover_domains(db_domains
)
17 # AgenDAV doesn't have a concept of domains.
22 def get_leftover_accounts(db_accounts
)
23 # Get a list of all users who have logged in to DAViCal.
24 davical_accounts
= self.get_davical_usernames()
25 return davical_accounts
- db_accounts
31 def get_davical_usernames()
35 connection
= PGconn
.connect(@db_host,
43 # User #1 is the super-user, and not tied to an email address.
44 sql_query
= 'SELECT username FROM usr WHERE user_no > 1;'
46 connection
.query(sql_query
) do |result
|
47 usernames
= result
.field_values('username')
52 # Pretend like we're database-agnostic in case we ever are.
53 raise DatabaseError
.new(e
)