X-Git-Url: http://gitweb.michael.orlitzky.com/?p=mailshears.git;a=blobdiff_plain;f=lib%2Frm%2Fplugins%2Froundcube_db.rb;fp=lib%2Frm%2Fplugins%2Froundcube_db.rb;h=0000000000000000000000000000000000000000;hp=5cda273643029ef808c9b184621017779f92806e;hb=7f8654ed6582062a295e1be75ae70e99de41b323;hpb=bd2dabf89ab277fbe315b05e6dfa839afb5ce5ef diff --git a/lib/rm/plugins/roundcube_db.rb b/lib/rm/plugins/roundcube_db.rb deleted file mode 100644 index 5cda273..0000000 --- a/lib/rm/plugins/roundcube_db.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'pg' - -require 'common/roundcube_db_plugin' -require 'rm/rm_plugin' - -class RoundcubeDbRm - - include RoundcubeDbPlugin - include RmPlugin - - def delete_account(account) - # Delete the given username and any records in other tables - # belonging to it. - raise NonexistentAccountError.new(account) if not user_exists(account) - - user_id = self.get_user_id(account) - - # The Roundcube developers were nice enough to include - # DBMS-specific install and upgrade scripts, so Postgres can take - # advantage of ON DELETE triggers. Here's an example: - # - # ... - # user_id integer NOT NULL - # REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE - # - # This query is of course necessary with any DBMS: - sql_queries = ['DELETE FROM users WHERE user_id = $1::int;'] - - begin - connection = PGconn.connect(@db_host, - @db_port, - @db_opts, - @db_tty, - @db_name, - @db_user, - @db_pass) - - sql_queries.each do |sql_query| - connection.query(sql_query, [user_id]) - end - - connection.close() - - rescue PGError => e - # Pretend like we're database-agnostic in case we ever are. - raise DatabaseError.new(e) - end - - end - -end