[Web] Remove dangling domain admins after deleting domain, fixes #3027 - again
parent
5e6a70c438
commit
8783ec4415
|
@ -3562,6 +3562,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
||||||
':domain' => $domain,
|
':domain' => $domain,
|
||||||
));
|
));
|
||||||
$stmt = $pdo->query("DELETE FROM `admin` WHERE `superadmin` = 0 AND `username` NOT IN (SELECT `username`FROM `domain_admins`);");
|
$stmt = $pdo->query("DELETE FROM `admin` WHERE `superadmin` = 0 AND `username` NOT IN (SELECT `username`FROM `domain_admins`);");
|
||||||
|
$stmt = $pdo->query("DELETE FROM `da_acl` WHERE `username` NOT IN (SELECT `username`FROM `domain_admins`);");
|
||||||
try {
|
try {
|
||||||
$redis->hDel('DOMAIN_MAP', $domain);
|
$redis->hDel('DOMAIN_MAP', $domain);
|
||||||
$redis->hDel('RL_VALUE', $domain);
|
$redis->hDel('RL_VALUE', $domain);
|
||||||
|
|
|
@ -3,7 +3,7 @@ function init_db_schema() {
|
||||||
try {
|
try {
|
||||||
global $pdo;
|
global $pdo;
|
||||||
|
|
||||||
$db_version = "11102019_0840";
|
$db_version = "1102019_1040";
|
||||||
|
|
||||||
$stmt = $pdo->query("SHOW TABLES LIKE 'versions'");
|
$stmt = $pdo->query("SHOW TABLES LIKE 'versions'");
|
||||||
$num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC));
|
$num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC));
|
||||||
|
@ -1088,6 +1088,7 @@ DELIMITER ;';
|
||||||
|
|
||||||
// Fix dangling domain admins
|
// Fix dangling domain admins
|
||||||
$stmt = $pdo->query("DELETE FROM `admin` WHERE `superadmin` = 0 AND `username` NOT IN (SELECT `username`FROM `domain_admins`);");
|
$stmt = $pdo->query("DELETE FROM `admin` WHERE `superadmin` = 0 AND `username` NOT IN (SELECT `username`FROM `domain_admins`);");
|
||||||
|
$stmt = $pdo->query("DELETE FROM `da_acl` WHERE `username` NOT IN (SELECT `username`FROM `domain_admins`);");
|
||||||
|
|
||||||
// Migrate attributes
|
// Migrate attributes
|
||||||
$stmt = $pdo->query("UPDATE `mailbox` SET `attributes` = '{}' WHERE `attributes` = '' OR `attributes` IS NULL;");
|
$stmt = $pdo->query("UPDATE `mailbox` SET `attributes` = '{}' WHERE `attributes` = '' OR `attributes` IS NULL;");
|
||||||
|
|
Loading…
Reference in New Issue