-
Notifications
You must be signed in to change notification settings - Fork 447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Delete Account #2472
Delete Account #2472
Changes from 38 commits
3689cda
27b1274
5ed98ba
2e857de
3cac897
a726238
00440ad
059d4e0
501c9a5
0485c36
da81c49
65c7cfd
fb85bd3
2e360d6
fd06682
d67a8c4
e821de2
4002f6d
b7bb437
ae17dfb
b4f0bae
bcd853b
f868227
cff14c4
ec98197
4720ab7
fd25c43
f551dd8
239af2d
53250e7
2145371
328a901
f7e310e
fdf493e
7172942
f799c9c
7ce2370
ae72004
b6804ab
0c2b0bc
83ea2bc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -303,6 +303,10 @@ class BoincTeamDelta { | |
$db = BoincDb::get(); | ||
return $db->enum('team_delta', 'BoincTeamDelta', $where_clause); | ||
} | ||
static function delete_for_user($user_id) { | ||
$db = BoincDb::get(); | ||
return $db->delete_aux('team_delta', "userid=$user_id"); | ||
} | ||
} | ||
|
||
class BoincHost { | ||
|
@@ -343,6 +347,10 @@ class BoincHost { | |
if (!$ret) return $ret; | ||
return $db->insert_id(); | ||
} | ||
static function delete_for_user($user_id) { | ||
$db = BoincDb::get(); | ||
return $db->delete_aux('host', "userid=$user_id"); | ||
} | ||
} | ||
|
||
class BoincResult { | ||
|
@@ -602,6 +610,10 @@ class BoincHostAppVersion { | |
$db = BoincDb::get(); | ||
return $db->update_aux('host_app_version', $clause); | ||
} | ||
static function delete_for_user($user_id) { | ||
$db = BoincDb::get(); | ||
return $db->delete_aux('host_app_version', "host_id in (select id from host where userid = $user_id)"); | ||
} | ||
} | ||
|
||
// DB utility functions | ||
|
@@ -823,6 +835,49 @@ class BoincToken { | |
return $db->affected_rows(); | ||
} | ||
|
||
static function delete_for_user($user_id) { | ||
$db = BoincDb::get(); | ||
$db->delete_aux('token', "userid=$user_id"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There should be an index on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. userid has an index but it was defined in schema.sql. I've moved it to constraints.sql. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks |
||
return $db->affected_rows(); | ||
} | ||
|
||
} | ||
|
||
class BoincUserDeleted { | ||
|
||
static function insert_user($user) { | ||
$now = time(); | ||
$cpid = md5($user->cross_project_id.$user->email_addr); | ||
$clause = "(userid, public_cross_project_id, create_time) values ($user->id, '$cpid', $now)"; | ||
$db = BoincDb::get(); | ||
return $db->insert('user_deleted', $clause); | ||
} | ||
|
||
static function delete_expired() { | ||
$db = BoincDb::get(); | ||
$expire_time = time() - 60*86400; //60 days ago | ||
$db->delete_aux('user_deleted', "create_time < $expire_time"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There should be an index on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added |
||
return $db->affected_rows(); | ||
} | ||
|
||
} | ||
|
||
class BoincHostDeleted { | ||
|
||
static function insert_hosts_for_user($user) { | ||
$now = time(); | ||
$clause = "select id, host_cpid, $now from host where userid = $user->id"; | ||
$db = BoincDb::get(); | ||
return $db->insert('host_deleted', $clause); | ||
} | ||
|
||
static function delete_expired() { | ||
$db = BoincDb::get(); | ||
$expire_time = time() - 60*86400; //60 days ago | ||
$db->delete_aux('host_deleted', "create_time < $expire_time"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There should be an index on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added |
||
return $db->affected_rows(); | ||
} | ||
|
||
} | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be an index on
team_delta.userid
to make this query efficient.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added