Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117752457
D5538.1775189404.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
D5538.1775189404.diff
View Options
diff --git a/src/app/Console/Commands/Data/MigrateCommand.php b/src/app/Console/Commands/Data/MigrateCommand.php
--- a/src/app/Console/Commands/Data/MigrateCommand.php
+++ b/src/app/Console/Commands/Data/MigrateCommand.php
@@ -53,6 +53,7 @@
public function handle()
{
$src = new DataMigrator\Account($this->argument('src'));
+ $src->metadata = $this->option('metadata');
$dst = new DataMigrator\Account($this->argument('dst'));
$folderMapping = [];
diff --git a/src/app/DataMigrator/Account.php b/src/app/DataMigrator/Account.php
--- a/src/app/DataMigrator/Account.php
+++ b/src/app/DataMigrator/Account.php
@@ -42,6 +42,9 @@
/** @var ?User User object */
protected $user;
+ /** @var array Metadata entries to migrate */
+ public $metadata;
+
/**
* Object constructor
*
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
@@ -117,6 +117,14 @@
}
*/
}
+
+ // Metadata
+ if (!empty($folder->metadata)) {
+ \Log::info("Setting METADATA " . var_export($folder->metadata, true));
+ if (!$this->imap->setMetadata($mailbox, $folder->metadata)) {
+ \Log::warning("Failed to set METADATA for {$mailbox} on the folder: {$this->imap->error}");
+ }
+ }
}
/**
@@ -210,6 +218,11 @@
\Log::warning("Failed to get ACL for the folder: {$this->imap->error}");
}
}
+
+ if ($this->imap->getCapability('METADATA') && !empty($this->account->metadata)) {
+ $folder->metadata = $this->imap->getMetadata($mailbox, $this->account->metadata)[$mailbox] ?? null;
+ }
+
}
/**
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Apr 3, 4:10 AM (15 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18822536
Default Alt Text
D5538.1775189404.diff (1 KB)
Attached To
Mode
D5538: Migrate IMAP metadata
Attached
Detach File
Event Timeline