mirror of
https://github.com/mailcow/mailcow-dockerized.git
synced 2025-12-13 09:56:01 +00:00
[Web] rename user in bcc_maps, recipient_maps and imapsync table
This commit is contained in:
@@ -3297,22 +3297,27 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|||||||
|
|
||||||
// Update the username in all related tables
|
// Update the username in all related tables
|
||||||
$tables = [
|
$tables = [
|
||||||
'tags_mailbox' => 'username',
|
'tags_mailbox' => ['username'],
|
||||||
'sieve_filters' => 'username',
|
'sieve_filters' => ['username'],
|
||||||
'app_passwd' => 'mailbox',
|
'app_passwd' => ['mailbox'],
|
||||||
'user_acl' => 'username',
|
'user_acl' => ['username'],
|
||||||
'da_acl' => 'username',
|
'da_acl' => ['username'],
|
||||||
'quota2' => 'username',
|
'quota2' => ['username'],
|
||||||
'quota2replica' => 'username',
|
'quota2replica' => ['username'],
|
||||||
'pushover' => 'username',
|
'pushover' => ['username'],
|
||||||
'alias' => 'goto'
|
'alias' => ['goto'],
|
||||||
|
"imapsync" => ['user2'],
|
||||||
|
'bcc_maps' => ['local_dest', 'bcc_dest'],
|
||||||
|
'recipient_maps' => ['old_dest', 'new_dest']
|
||||||
];
|
];
|
||||||
foreach ($tables as $table => $column) {
|
foreach ($tables as $table => $columns) {
|
||||||
$pdo->prepare("UPDATE $table SET $column = :new_username WHERE $column = :old_username")
|
foreach ($columns as $column) {
|
||||||
->execute([
|
$stmt = $pdo->prepare("UPDATE $table SET $column = :new_username WHERE $column = :old_username")
|
||||||
':new_username' => $new_username,
|
->execute([
|
||||||
':old_username' => $old_username
|
':new_username' => $new_username,
|
||||||
]);
|
':old_username' => $old_username
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update c_uid, c_name and mail in _sogo_static_view table
|
// Update c_uid, c_name and mail in _sogo_static_view table
|
||||||
|
|||||||
Reference in New Issue
Block a user