Skip to content

Commit efa66d5

Browse files
committed
Move SMTP into integrations group (external mail relay; same shape as webhook)
1 parent cd3fb87 commit efa66d5

4 files changed

Lines changed: 28 additions & 27 deletions

File tree

src/Migration/Destinations/Appwrite.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -292,13 +292,13 @@ public static function getSupportedResources(): array
292292
Resource::TYPE_PLATFORM,
293293
Resource::TYPE_API_KEY,
294294
Resource::TYPE_WEBHOOK,
295+
Resource::TYPE_SMTP,
295296

296297
// Project
297298
Resource::TYPE_PROJECT_VARIABLE,
298299
Resource::TYPE_PROJECT_PROTOCOLS,
299300
Resource::TYPE_PROJECT_LABELS,
300301
Resource::TYPE_PROJECT_SERVICES,
301-
Resource::TYPE_SMTP,
302302

303303
// Backups
304304
Resource::TYPE_BACKUP_POLICY,
@@ -3115,6 +3115,10 @@ public function importIntegrationsResource(Resource $resource): Resource
31153115
/** @var Webhook $resource */
31163116
$this->createWebhook($resource);
31173117
break;
3118+
case Resource::TYPE_SMTP:
3119+
/** @var SMTP $resource */
3120+
$this->createSMTP($resource);
3121+
break;
31183122
}
31193123

31203124
if ($resource->getStatus() !== Resource::STATUS_SKIPPED) {
@@ -3143,10 +3147,6 @@ public function importProjectsResource(Resource $resource): Resource
31433147
/** @var ServicesResource $resource */
31443148
$this->createServices($resource);
31453149
break;
3146-
case Resource::TYPE_SMTP:
3147-
/** @var SMTP $resource */
3148-
$this->createSMTP($resource);
3149-
break;
31503150
}
31513151

31523152
if ($resource->getStatus() !== Resource::STATUS_SKIPPED) {

src/Migration/Resources/Settings/SMTP.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public static function getName(): string
7979

8080
public function getGroup(): string
8181
{
82-
return Transfer::GROUP_PROJECTS;
82+
return Transfer::GROUP_INTEGRATIONS;
8383
}
8484

8585
public function getEnabled(): bool

src/Migration/Sources/Appwrite.php

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ public static function getSupportedResources(): array
227227
Resource::TYPE_PLATFORM,
228228
Resource::TYPE_API_KEY,
229229
Resource::TYPE_WEBHOOK,
230+
Resource::TYPE_SMTP,
230231

231232
// Backups
232233
Resource::TYPE_BACKUP_POLICY,
@@ -236,7 +237,6 @@ public static function getSupportedResources(): array
236237
Resource::TYPE_PROJECT_PROTOCOLS,
237238
Resource::TYPE_PROJECT_LABELS,
238239
Resource::TYPE_PROJECT_SERVICES,
239-
Resource::TYPE_SMTP,
240240
];
241241
}
242242

@@ -1597,11 +1597,6 @@ private function reportProjects(array $resources, array &$report, array $resourc
15971597
// Singleton — one services config per project.
15981598
$report[Resource::TYPE_PROJECT_SERVICES] = 1;
15991599
}
1600-
1601-
if (\in_array(Resource::TYPE_SMTP, $resources)) {
1602-
// Singleton — one SMTP config per project.
1603-
$report[Resource::TYPE_SMTP] = 1;
1604-
}
16051600
}
16061601

16071602
/**
@@ -1666,19 +1661,6 @@ protected function exportGroupProjects(int $batchSize, array $resources): void
16661661
));
16671662
}
16681663

1669-
try {
1670-
if (\in_array(Resource::TYPE_SMTP, $resources)) {
1671-
$this->exportSMTP();
1672-
}
1673-
} catch (\Throwable $e) {
1674-
$this->addError(new Exception(
1675-
Resource::TYPE_SMTP,
1676-
Transfer::GROUP_PROJECTS,
1677-
message: $e->getMessage(),
1678-
code: (int) $e->getCode() ?: Exception::CODE_INTERNAL,
1679-
previous: $e
1680-
));
1681-
}
16821664
}
16831665

16841666
private function exportServices(): void
@@ -2673,6 +2655,11 @@ private function reportIntegrations(array $resources, array &$report, array $res
26732655
$report[Resource::TYPE_WEBHOOK] = 0;
26742656
}
26752657
}
2658+
2659+
if (\in_array(Resource::TYPE_SMTP, $resources)) {
2660+
// Singleton — one SMTP config per project.
2661+
$report[Resource::TYPE_SMTP] = 1;
2662+
}
26762663
}
26772664

26782665
/**
@@ -2746,6 +2733,20 @@ protected function exportGroupIntegrations(int $batchSize, array $resources): vo
27462733
));
27472734
}
27482735
}
2736+
2737+
try {
2738+
if (\in_array(Resource::TYPE_SMTP, $resources)) {
2739+
$this->exportSMTP();
2740+
}
2741+
} catch (\Throwable $e) {
2742+
$this->addError(new Exception(
2743+
Resource::TYPE_SMTP,
2744+
Transfer::GROUP_INTEGRATIONS,
2745+
message: $e->getMessage(),
2746+
code: (int) $e->getCode() ?: Exception::CODE_INTERNAL,
2747+
previous: $e
2748+
));
2749+
}
27492750
}
27502751

27512752
/**

src/Migration/Transfer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class Transfer
6868
Resource::TYPE_PLATFORM,
6969
Resource::TYPE_API_KEY,
7070
Resource::TYPE_WEBHOOK,
71+
Resource::TYPE_SMTP,
7172
];
7273
public const GROUP_DOCUMENTSDB_RESOURCES = [
7374
Resource::TYPE_DATABASE_DOCUMENTSDB,
@@ -102,7 +103,6 @@ class Transfer
102103
Resource::TYPE_PROJECT_PROTOCOLS,
103104
Resource::TYPE_PROJECT_LABELS,
104105
Resource::TYPE_PROJECT_SERVICES,
105-
Resource::TYPE_SMTP,
106106
];
107107

108108
public const GROUP_BACKUPS_RESOURCES = [
@@ -145,13 +145,13 @@ class Transfer
145145
Resource::TYPE_PLATFORM,
146146
Resource::TYPE_API_KEY,
147147
Resource::TYPE_WEBHOOK,
148+
Resource::TYPE_SMTP,
148149

149150
// Project
150151
Resource::TYPE_PROJECT_VARIABLE,
151152
Resource::TYPE_PROJECT_PROTOCOLS,
152153
Resource::TYPE_PROJECT_LABELS,
153154
Resource::TYPE_PROJECT_SERVICES,
154-
Resource::TYPE_SMTP,
155155

156156
// legacy
157157
Resource::TYPE_DOCUMENT,

0 commit comments

Comments
 (0)