Skip to content

Commit

Permalink
fix conversion from numeric to string IDs - special_imap_folders clea…
Browse files Browse the repository at this point in the history
…nup and custom_imap_sources conversion - makes upgrades from 1.x to 2.x seamless regarding sources in combined inbox
  • Loading branch information
kroky committed Aug 16, 2024
1 parent 8b0ed3a commit 652e144
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions lib/repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,27 @@ protected static function migrateFromIntegerIds() {
}
if (! empty($config['special_imap_folders'])) {
foreach ($config['special_imap_folders'] as $id => $special) {
if (is_numeric($id) && isset($replacements['imap'][$id])) {
$config['special_imap_folders'][$replacements['imap'][$id]] = $special;
if (is_numeric($id)) {
if (isset($replacements['imap'][$id])) {
$config['special_imap_folders'][$replacements['imap'][$id]] = $special;
}
unset($config['special_imap_folders'][$id]);
$changed = true;
}
}
}
if (! empty($config['custom_imap_sources'])) {
foreach ($config['custom_imap_sources'] as $id => $val) {
if (preg_match('/^imap_(\d+)_([0-9a-z]+)$/', $id, $m)) {
$old_id = $m[1];
if (isset($replacements['imap'][$old_id])) {
$config['custom_imap_sources']['imap_' . $replacements['imap'][$old_id] . '_' . $m[2]] = $val;
}
unset($config['custom_imap_sources'][$id]);
$changed = true;
}
}
}
if ($changed) {
self::$user_config->reload($config, self::$session->get('username'));
self::$session->set('user_data', self::$user_config->dump());
Expand Down

0 comments on commit 652e144

Please sign in to comment.