Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117745218
D5820.1775171280.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D5820.1775171280.diff
View Options
diff --git a/src/app/DataMigrator/Driver/IMAP.php b/src/app/DataMigrator/Driver/IMAP.php
--- a/src/app/DataMigrator/Driver/IMAP.php
+++ b/src/app/DataMigrator/Driver/IMAP.php
@@ -319,6 +319,10 @@
return;
}
+ $targetCount = count($existing);
+ $srcCount = count($existing);
+ \Log::info("Found {$targetCount} existing messages in the target and {$srcCount} in the source mailbox: {$mailbox}");
+
$set = new ItemSet();
foreach ($messages as $message) {
@@ -328,12 +332,18 @@
// Skip message that exists and did not change
$exists = $existing[$id] ?? null;
if ($exists) {
+ // With duplicates we can't detect changes (because we don't know what to compare to), so we skip.
+ if (isset($exists['duplicates'])) {
+ continue;
+ }
if (
$message->size == $exists['size']
&& \rcube_utils::strtotime($message->internaldate) == \rcube_utils::strtotime($exists['date'])
&& $this->filterImapFlags(array_keys($message->flags)) == $exists['flags']
) {
continue;
+ } else {
+ \Log::info("Existing but size/date/flags changed (Uid: {$message->uid} Id $id): Size {$message->size} Existing size {$exists['size']}");
}
}
@@ -421,6 +431,13 @@
// Generate message ID if the header does not exist
$id = $this->getMessageId($message, $mailbox);
+ // We don't handle duplicate message id's. Let the lowest uid win, and mark as duplicate.
+ if (!empty($result[$id])) {
+ $result[$id]['duplicates'] = true;
+ \Log::info("Skipping duplicate for id $id with uid {$message->uid}");
+ continue;
+ }
+
$result[$id] = [
'uid' => $message->uid,
'flags' => $flags,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Apr 2, 11:08 PM (9 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18821425
Default Alt Text
D5820.1775171280.diff (1 KB)
Attached To
Mode
D5820: Detect and skip over duplicate message-id's during migration
Attached
Detach File
Event Timeline