]>
gitweb.michael.orlitzky.com - mailshears.git/blob - lib/rm/plugins/roundcube.rb
3 require 'common/roundcube_plugin'
8 include RoundcubePlugin
12 # Delete the given username and any records in other tables
14 raise NonexistentUserError
.new(user
.to_s()) if not user_exists(user
)
16 user_id
= self.get_user_id(user
)
18 # The Roundcube developers were nice enough to include
19 # DBMS-specific install and upgrade scripts, so Postgres can take
20 # advantage of ON DELETE triggers. Here's an example:
23 # user_id integer NOT NULL
24 # REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE
26 # This query is of course necessary with any DBMS:
27 sql_queries
= ['DELETE FROM users WHERE user_id = $1::int;']
29 connection
= PGconn
.connect(@db_host, @db_port, @db_opts, @db_tty,
30 @db_name, @db_user, @db_pass)
32 sql_queries
.each
do |sql_query
|
33 connection
.query(sql_query
, [user_id
])