Commit ab83396c authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review

Merge "Bug 1734186: remove the username and email when deleting user"

parents 07f73600 31a5ceb2
......@@ -5553,5 +5553,13 @@ function xmldb_core_upgrade($oldversion=0) {
reload_html_filters();
}
if ($oldversion < 2018010300) {
$sql = "UPDATE {usr}
SET username = CONCAT(MD5(username), 1000000 + id),
email = CONCAT(MD5(email), 1000000 + id)
WHERE deleted = 1 ";
execute_sql($sql);
}
return $status;
}
......@@ -1514,7 +1514,8 @@ function delete_user($userid) {
$deleterec->deleted = 1;
foreach ($fieldstomunge as $field) {
if (!preg_match('/\.deleted\.\d+$/', $user->$field)) {
$deleterec->$field = $user->$field . $datasuffix;
$hash = md5($user->$field . $datasuffix) . (1000000 + $userid);
$deleterec->$field = $hash;
}
}
......@@ -1622,7 +1623,7 @@ function delete_user($userid) {
/**
* Undeletes a user
*
* NOTE: changing their email addresses to remove the .deleted.timestamp part
* NOTE: changing their email addresses to replace the field.deleted.timestamp part
* has not been implemented yet! This function is not actually used anywhere in
* Mahara, so hasn't really been tested because of this. It's a simple enough
* job for the first person who gets there - see how delete_user works to see
......
......@@ -16,7 +16,7 @@ $config = new stdClass();
// See https://wiki.mahara.org/wiki/Developer_Area/Version_Numbering_Policy
// For upgrades on stable branches, increment the version by one. On master, use the date.
$config->version = 2017110600;
$config->version = 2018010300;
$config->series = '18.04';
$config->release = '18.04dev';
$config->minupgradefrom = 2015030409;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment