public
nobgit
read
NobMail
Based on mailcow: dockerized
Languages
Repository composition by tracked source files.
PHP
49%
JavaScript
35%
HTML
9%
CSS
4%
Shell
2%
Python
1%
Lua
0%
Perl
0%
Ruby
0%
SCSS
0%
Create file
Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git
Commit
[Web] rename user in bcc_maps, recipient_maps and imapsync table
4f9e37c0
data/web/inc/functions.mailbox.inc.php | 35 +++++++++++++++++++---------------
1 file changed, 20 insertions(+), 15 deletions(-)
Diff
diff --git a/data/web/inc/functions.mailbox.inc.php b/data/web/inc/functions.mailbox.inc.php
index 9a1ae577..9c01e78e 100644
--- a/data/web/inc/functions.mailbox.inc.php
+++ b/data/web/inc/functions.mailbox.inc.php
@@ -3297,22 +3297,27 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
// Update the username in all related tables
$tables = [
- 'tags_mailbox' => 'username',
- 'sieve_filters' => 'username',
- 'app_passwd' => 'mailbox',
- 'user_acl' => 'username',
- 'da_acl' => 'username',
- 'quota2' => 'username',
- 'quota2replica' => 'username',
- 'pushover' => 'username',
- 'alias' => 'goto'
+ 'tags_mailbox' => ['username'],
+ 'sieve_filters' => ['username'],
+ 'app_passwd' => ['mailbox'],
+ 'user_acl' => ['username'],
+ 'da_acl' => ['username'],
+ 'quota2' => ['username'],
+ 'quota2replica' => ['username'],
+ 'pushover' => ['username'],
+ 'alias' => ['goto'],
+ "imapsync" => ['user2'],
+ 'bcc_maps' => ['local_dest', 'bcc_dest'],
+ 'recipient_maps' => ['old_dest', 'new_dest']
];
- foreach ($tables as $table => $column) {
- $pdo->prepare("UPDATE $table SET $column = :new_username WHERE $column = :old_username")
- ->execute([
- ':new_username' => $new_username,
- ':old_username' => $old_username
- ]);
+ foreach ($tables as $table => $columns) {
+ foreach ($columns as $column) {
+ $stmt = $pdo->prepare("UPDATE $table SET $column = :new_username WHERE $column = :old_username")
+ ->execute([
+ ':new_username' => $new_username,
+ ':old_username' => $old_username
+ ]);
+ }
}
// Update c_uid, c_name and mail in _sogo_static_view table