# HG changeset patch # User jbe # Date 1330440879 -3600 # Node ID 10a231cfd585bb16bd1b7182e5be24442d955cff # Parent 18e1cd384528cb3230dd0d98ded87a1a76f0233b Delete non-activated members in function "delete_private_data" diff -r 18e1cd384528 -r 10a231cfd585 core.sql --- a/core.sql Tue Feb 28 11:59:19 2012 +0100 +++ b/core.sql Tue Feb 28 15:54:39 2012 +0100 @@ -4161,6 +4161,7 @@ RETURNS VOID LANGUAGE 'plpgsql' VOLATILE AS $$ BEGIN + DELETE FROM "member" WHERE "activated" ISNULL; UPDATE "member" SET "invite_code" = NULL, "last_login" = NULL, diff -r 18e1cd384528 -r 10a231cfd585 update/core-update.v2.0.3-v2.0.4.sql --- a/update/core-update.v2.0.3-v2.0.4.sql Tue Feb 28 11:59:19 2012 +0100 +++ b/update/core-update.v2.0.3-v2.0.4.sql Tue Feb 28 15:54:39 2012 +0100 @@ -120,4 +120,56 @@ AND "ignored_initiative"."member_id" ISNULL; COMMENT ON VIEW "selected_event_seen_by_member" IS 'Events as seen by a member, depending on its memberships, interests, support and members "notify_level"'; +-- delete non-activated members in function "delete_private_data": +CREATE OR REPLACE FUNCTION "delete_private_data"() + RETURNS VOID + LANGUAGE 'plpgsql' VOLATILE AS $$ + BEGIN + DELETE FROM "member" WHERE "activated" ISNULL; + UPDATE "member" SET + "invite_code" = NULL, + "last_login" = NULL, + "login" = NULL, + "password" = NULL, + "notify_email" = NULL, + "notify_email_unconfirmed" = NULL, + "notify_email_secret" = NULL, + "notify_email_secret_expiry" = NULL, + "notify_email_lock_expiry" = NULL, + "password_reset_secret" = NULL, + "password_reset_secret_expiry" = NULL, + "organizational_unit" = NULL, + "internal_posts" = NULL, + "realname" = NULL, + "birthday" = NULL, + "address" = NULL, + "email" = NULL, + "xmpp_address" = NULL, + "website" = NULL, + "phone" = NULL, + "mobile_phone" = NULL, + "profession" = NULL, + "external_memberships" = NULL, + "external_posts" = NULL, + "statement" = NULL; + -- "text_search_data" is updated by triggers + DELETE FROM "setting"; + DELETE FROM "setting_map"; + DELETE FROM "member_relation_setting"; + DELETE FROM "member_image"; + DELETE FROM "contact"; + DELETE FROM "ignored_member"; + DELETE FROM "area_setting"; + DELETE FROM "issue_setting"; + DELETE FROM "ignored_initiative"; + DELETE FROM "initiative_setting"; + DELETE FROM "suggestion_setting"; + DELETE FROM "non_voter"; + DELETE FROM "direct_voter" USING "issue" + WHERE "direct_voter"."issue_id" = "issue"."id" + AND "issue"."closed" ISNULL; + RETURN; + END; + $$; + COMMIT;