Skip to content
Permalink
Browse files

clean up data of disabled users; updates #724

  • Loading branch information...
following5 committed Jun 25, 2015
1 parent 04c3b3c commit f323b09614957639066f7ef482e1d54e03c8ffb6
Showing with 12 additions and 2 deletions.
  1. +6 −0 bin/dbsv-update.php
  2. +6 −2 htdocs/lib2/logic/user.class.php
@@ -468,6 +468,12 @@ function dbv_125() // update cache lists implementation; preparation of XML int
update_triggers(); // runs maintain-125.inc.php
}
function dbv_126() // clean up data of disabled accounts
{
sql("DELETE FROM `cache_adoption` WHERE `user_id` IN (SELECT `user_id` FROM `user` WHERE `is_active_flag`=0)");
sql("DELETE FROM `cache_ignore` WHERE `user_id` IN (SELECT `user_id` FROM `user` WHERE `is_active_flag`=0)");
sql("DELETE FROM `cache_watches` WHERE `user_id` IN (SELECT `user_id` FROM `user` WHERE `is_active_flag`=0)");
}
// When adding new mutations, take care that they behave well if run multiple
// times. This improves robustness of database versioning.
@@ -761,8 +761,12 @@ function disable()
sql("DELETE FROM `user_options` WHERE `user_id`='&1'", $this->nUserId);
$this->reload();
sql("DELETE FROM `cache_lists` WHERE `user_id`='&1'", $this->nUserId);
// Triggers will do all the dependent clean-up.
sql("DELETE FROM `cache_lists` WHERE `user_id`='&1'", $this->nUserId); // Triggers will do all the dependent clean-up.
sql("DELETE FROM `cache_adoption` WHERE `user_id`='&1'", $this->nUserId);
sql("DELETE FROM `cache_ignore` WHERE `user_id`='&1'", $this->nUserId);
sql("DELETE FROM `cache_watches` WHERE `user_id`='&1'", $this->nUserId);
sql("DELETE FROM `watches_waiting` WHERE `user_id`='&1'", $this->nUserId);
sql("DELETE FROM `notify_waiting` WHERE `user_id`='&1'", $this->nUserId);
// lock the user's caches
$error = false;

0 comments on commit f323b09

Please sign in to comment.
You can’t perform that action at this time.