Skip to content

Commit 0766cd9

Browse files
committed
fix: skip paginated export for functions/sites with no active deployment
When exportOnlyActive is true, functions/sites without an active deployment ID should be skipped entirely rather than falling back to the full paginated listing.
1 parent f27276b commit 0766cd9

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/Migration/Sources/Appwrite.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1641,8 +1641,13 @@ private function exportDeployments(int $batchSize, bool $exportOnlyActive = fals
16411641
/** @var Func $func */
16421642
$lastDocument = null;
16431643

1644-
if ($exportOnlyActive && $func->getActiveDeployment()) {
1645-
$deployment = $this->functions->getDeployment($func->getId(), $func->getActiveDeployment());
1644+
if ($exportOnlyActive) {
1645+
$activeDeploymentId = $func->getActiveDeployment();
1646+
if (empty($activeDeploymentId)) {
1647+
continue; // active-only mode: nothing to export for this function
1648+
}
1649+
1650+
$deployment = $this->functions->getDeployment($func->getId(), $activeDeploymentId);
16461651

16471652
try {
16481653
$this->exportDeploymentData($func, $deployment);
@@ -1863,8 +1868,13 @@ private function exportSiteDeployments(int $batchSize, bool $exportOnlyActive =
18631868
/** @var Site $site */
18641869
$lastDocument = null;
18651870

1866-
if ($exportOnlyActive && $site->getActiveDeployment()) {
1867-
$deployment = $this->sites->getDeployment($site->getId(), $site->getActiveDeployment());
1871+
if ($exportOnlyActive) {
1872+
$activeDeploymentId = $site->getActiveDeployment();
1873+
if (empty($activeDeploymentId)) {
1874+
continue; // active-only mode: nothing to export for this site
1875+
}
1876+
1877+
$deployment = $this->sites->getDeployment($site->getId(), $activeDeploymentId);
18681878

18691879
try {
18701880
$this->exportSiteDeploymentData($site, $deployment);

0 commit comments

Comments
 (0)