liquid_feedback_core

changeset 107:53ae1d37e5de

Update file: Included last two changes, initialize "locked" using "active" field
author jbe
date Sat Feb 05 16:26:39 2011 +0100 (2011-02-05)
parents 4d121276bf04
children ea4928ccc8eb
files update/core-update.v1.3.0-v1.3.1.sql
line diff
     1.1 --- a/update/core-update.v1.3.0-v1.3.1.sql	Sat Feb 05 16:18:07 2011 +0100
     1.2 +++ b/update/core-update.v1.3.0-v1.3.1.sql	Sat Feb 05 16:26:39 2011 +0100
     1.3 @@ -15,6 +15,8 @@
     1.4  ALTER TABLE "member" ADD COLUMN "last_login_public" DATE;
     1.5  ALTER TABLE "member" ADD COLUMN "locked" BOOLEAN NOT NULL DEFAULT FALSE;
     1.6  
     1.7 +UPDATE "member" SET "locked" = TRUE WHERE "active" = FALSE;
     1.8 +
     1.9  COMMENT ON COLUMN "member"."last_login"        IS 'Timestamp of last login';
    1.10  COMMENT ON COLUMN "member"."last_login_public" IS 'Date of last login (time stripped for privacy reasons, updated only after day change)';
    1.11  COMMENT ON COLUMN "member"."locked"            IS 'Locked members can not log in.';
    1.12 @@ -29,10 +31,20 @@
    1.13        SELECT * INTO "system_setting_row" FROM "system_setting";
    1.14        LOCK TABLE "member" IN SHARE ROW EXCLUSIVE MODE;
    1.15        UPDATE "member" SET "last_login_public" = "last_login"::date
    1.16 -        WHERE "last_login"::date < 'today';
    1.17 +        FROM (
    1.18 +          SELECT DISTINCT "member"."id"
    1.19 +          FROM "member" LEFT JOIN "member_history"
    1.20 +          ON "member"."id" = "member_history"."member_id"
    1.21 +          WHERE "member"."last_login"::date < 'today' OR (
    1.22 +            "member_history"."until"::date >= 'today' AND
    1.23 +            "member_history"."active" = FALSE AND "member"."active" = TRUE
    1.24 +          )
    1.25 +        ) AS "subquery"
    1.26 +        WHERE "member"."id" = "subquery"."id";
    1.27        IF "system_setting_row"."member_ttl" NOTNULL THEN
    1.28          UPDATE "member" SET "active" = FALSE
    1.29            WHERE "active" = TRUE
    1.30 +          AND "last_login"::date < 'today'
    1.31            AND "last_login_public" <
    1.32              (now() - "system_setting_row"."member_ttl")::date;
    1.33        END IF;
    1.34 @@ -40,7 +52,7 @@
    1.35      END;
    1.36    $$;
    1.37  
    1.38 -COMMENT ON FUNCTION "check_last_login"() IS 'Updates "last_login_public" field, which contains the date but not the time of the last login, and deactivates members who do not login for the time specified in "system_setting"."member_ttl". For privacy reasons this function does not update "last_login_public", if the last login of a member has been today.';
    1.39 +COMMENT ON FUNCTION "check_last_login"() IS 'Updates "last_login_public" field, which contains the date but not the time of the last login, and deactivates members who do not login for the time specified in "system_setting"."member_ttl". For privacy reasons this function does not update "last_login_public", if the last login of a member has been today (except when member was reactivated today).';
    1.40  
    1.41  CREATE OR REPLACE FUNCTION "create_interest_snapshot"
    1.42    ( "issue_id_p" "issue"."id"%TYPE )

Impressum / About Us