diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php index 6de71cfae6..d97bb92b73 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php @@ -89,8 +89,6 @@ class Update extends Base throw new Exception(Exception::BUILD_NOT_READY); } - $oldDeploymentInternalId = $function->getAttribute('deploymentInternalId', ''); - $function = $dbForProject->updateDocument('functions', $function->getId(), new Document(array_merge($function->getArrayCopy(), [ 'deploymentInternalId' => $deployment->getInternalId(), 'deploymentId' => $deployment->getId(), @@ -106,18 +104,13 @@ class Update extends Base Authorization::skip(fn () => $dbForPlatform->updateDocument('schedules', $schedule->getId(), $schedule)); $queries = [ - Query::equal('trigger', 'manual'), + Query::equal('trigger', ['manual']), Query::equal("type", ["deployment"]), Query::equal("deploymentResourceType", ["function"]), Query::equal("deploymentResourceInternalId", [$function->getInternalId()]), + Query::equal("deploymentVcsProviderBranch", [""]), ]; - if (empty($oldDeploymentInternalId)) { - $queries[] = Query::equal("deploymentInternalId", [""]); - } else { - $queries[] = Query::equal("deploymentInternalId", [$oldDeploymentInternalId]); - } - $this->listRules($project, $queries, $dbForPlatform, function (Document $rule) use ($dbForPlatform, $deployment) { $rule = $rule ->setAttribute('deploymentId', $deployment->getId()) diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index 0ecf1d3f73..b5bd2ee8e6 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -1075,8 +1075,6 @@ class Builds extends Action $resource->setAttribute('live', true); switch ($resource->getCollection()) { case 'functions': - $oldDeploymentInternalId = $resource->getAttribute('deploymentInternalId', ''); - $resource->setAttribute('deploymentId', $deployment->getId()); $resource->setAttribute('deploymentInternalId', $deployment->getInternalId()); $resource->setAttribute('deploymentCreatedAt', $deployment->getCreatedAt()); @@ -1088,14 +1086,9 @@ class Builds extends Action Query::equal("deploymentResourceInternalId", [$resource->getInternalId()]), Query::equal('deploymentResourceType', ['function']), Query::equal('trigger', ['manual']), + Query::equal('deploymentVcsProviderBranch', ['']), ]; - if (empty($oldDeploymentInternalId)) { - $queries[] = Query::equal("deploymentInternalId", [""]); - } else { - $queries[] = Query::equal("deploymentInternalId", [$oldDeploymentInternalId]); - } - $rulesUpdated = false; $this->listRules($project, $queries, $dbForPlatform, function (Document $rule) use ($dbForPlatform, $deployment, &$rulesUpdated) { $rulesUpdated = true; @@ -1106,8 +1099,6 @@ class Builds extends Action }); break; case 'sites': - $oldDeploymentInternalId = $resource->getAttribute('deploymentInternalId', ''); - $resource->setAttribute('deploymentId', $deployment->getId()); $resource->setAttribute('deploymentInternalId', $deployment->getInternalId()); $resource->setAttribute('deploymentScreenshotDark', $deployment->getAttribute('screenshotDark', '')); @@ -1120,14 +1111,9 @@ class Builds extends Action Query::equal("deploymentResourceInternalId", [$resource->getInternalId()]), Query::equal('deploymentResourceType', ['site']), Query::equal('trigger', ['manual']), + Query::equal('deploymentVcsProviderBranch', ['']), ]; - if (empty($oldDeploymentInternalId)) { - $queries[] = Query::equal("deploymentInternalId", [""]); - } else { - $queries[] = Query::equal("deploymentInternalId", [$oldDeploymentInternalId]); - } - $this->listRules($project, $queries, $dbForPlatform, function (Document $rule) use ($dbForPlatform, $deployment) { $rule = $rule ->setAttribute('deploymentId', $deployment->getId()) diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Deployment/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Deployment/Update.php index 7f1681c0f1..aa36b52c5a 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Deployment/Update.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Deployment/Update.php @@ -86,8 +86,6 @@ class Update extends Base throw new Exception(Exception::BUILD_NOT_READY); } - $oldDeploymentInternalId = $site->getAttribute('deploymentInternalId', ''); - $site = $dbForProject->updateDocument('sites', $site->getId(), new Document(array_merge($site->getArrayCopy(), [ 'deploymentInternalId' => $deployment->getInternalId(), 'deploymentId' => $deployment->getId(), @@ -97,18 +95,13 @@ class Update extends Base ]))); $queries = [ - Query::equal('trigger', 'manual'), + Query::equal('trigger', ['manual']), Query::equal("type", ["deployment"]), Query::equal("deploymentResourceType", ["site"]), Query::equal("deploymentResourceInternalId", [$site->getInternalId()]), + Query::equal("deploymentVcsProviderBranch", [""]), ]; - if (empty($oldDeploymentInternalId)) { - $queries[] = Query::equal("deploymentInternalId", [""]); - } else { - $queries[] = Query::equal("deploymentInternalId", [$oldDeploymentInternalId]); - } - $this->listRules($project, $queries, $dbForPlatform, function (Document $rule) use ($dbForPlatform, $deployment) { $rule = $rule ->setAttribute('deploymentId', $deployment->getId())