forked from antzucaro/XonStat
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changed meaning of privacy_match_hist=3 from "not tracked" to "anonym…
…ous". unregistered player are now by default added to the database and treated as anonymous. only steam-id + current rating is stored, no match history or nick names. - hardened account deletion to prevent deleting system-internal player IDs (<= 2) - added function to erase/anonymize match history and aliases without deleting the account - added UI for players who decided to have their account deleted - added "last_used_dt" to player_nicks - daily maintenance script to delete aliases that have not been used for 60 days - daily maintenance script to purge hashkeys/steam-ids of deleted users after 60 days so they can re-register - changed getOrCreatePlayer stored proc, which is now used by submision.py
- Loading branch information
Showing
15 changed files
with
240 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<h1>Account deleted</h1> | ||
On <%= player.delete_dt.toLocaleDateString(undefined, { timeZone: 'UTC', year: 'numeric', month: '2-digit', day: '2-digit' }) %> you chose to delete your account. | ||
<br/>As you were informed back then, you won't be able to re-register for a total period of 60 days. | ||
<br/>This step is necessary to avoid abusive reset of ratings by repeated deleting + registering. | ||
<p><b>Sorry!</b></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
set search_path=xonstat,public; | ||
|
||
update players set privacy_match_hist=3 where player_id in (24024, 26236); | ||
|
||
do $$ | ||
declare gid bigint; | ||
begin | ||
select game_id into gid from games where match_id='a6558e8a-b1d4-4c69-acac-5cf3cf13c588'; | ||
delete from player_weapon_stats where game_id=gid; | ||
delete from player_game_stats where game_id=gid; | ||
delete from games where game_id=gid; | ||
end | ||
$$; | ||
|
||
|
||
select * from players where player_id=14; | ||
select * from hashkeys where hashkey='76561198137367816' | ||
delete from hashkeys where hashkey='76561198137367816' | ||
delete from hashkeys where active_ind=false and timezone('UTC', now()) - delete_dt >= '-1 days'; | ||
select *,timezone('UTC', now()) - delete_dt from hashkeys where active_ind=false and timezone('UTC', now()) - delete_dt >= '-1 days'; | ||
delete from player_nicks where timezone('UTC', now()) - create_dt >= '60 days' and (last_used_dt is null or timezone('UTC', now()) - create_dt >= '60 days'); | ||
select * from player_nicks where player_id=23525 | ||
select * from players where player_id=23525 | ||
|
||
select timezone('utc',now()), now() - timezone('utc',now()) | ||
|
||
create or replace function xonstat.getOrCreatePlayer(steamid varchar(30), rawNick varchar(64), strippedNick varchar(64)) returns integer as $$ | ||
declare | ||
id integer; | ||
dummy integer; | ||
oldNick varchar(64); | ||
active boolean; | ||
privacyMode integer; | ||
rowcount integer; | ||
begin | ||
loop | ||
select h.active_ind, p.player_id, nick, privacy_match_hist | ||
into active, id, oldNick, privacyMode | ||
from xonstat.hashkeys h left outer join xonstat.players p on p.player_id=h.player_id where h.hashkey=steamid; | ||
if found then | ||
if not active then | ||
-- player requested to be erased and forgotten | ||
return null; | ||
end if; | ||
if privacyMode<>3 then | ||
update xonstat.players set nick=rawNick, stripped_nick=strippedNick where player_id=id; | ||
update xonstat.player_nicks set last_used_dt=now() where player_id=id and stripped_nick=strippedNick; | ||
get diagnostics rowcount = row_count; | ||
if rowcount = 0 then | ||
insert into xonstat.player_nicks(player_id, stripped_nick, nick) values (id, strippedNick, rawNick); | ||
end if; | ||
end if; | ||
return id; | ||
end if; | ||
|
||
begin | ||
select nextval('xonstat.players_player_id_seq'::regclass) into id; | ||
insert into xonstat.players (player_id,privacy_match_hist,nick,stripped_nick) values (id, 3, 'Anonymous Player', 'Anonymous Player'); | ||
insert into xonstat.hashkeys (player_id, hashkey) values (id, steamid); | ||
return id; | ||
exception when unique_violation then | ||
-- try again | ||
end; | ||
|
||
return null; | ||
end loop; | ||
end; | ||
$$ language plpgsql; | ||
|
||
select getOrCreatePlayer('12345','foo','foo') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
-- delete from hashkeys where active_ind=false and now() - delete_dt >= 60; | ||
delete from hashkeys where active_ind=false and timezone('UTC', now()) - delete_dt >= '60 days'; |
Oops, something went wrong.