From 681b6031aa5dfc85bd78796d7f05e85a339e7023 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Wed, 26 Mar 2025 12:59:15 +0100 Subject: [PATCH] Linter fix --- app/controllers/general.php | 2 +- src/Appwrite/Auth/Key.php | 2 +- .../Platform/Modules/Functions/Workers/Builds.php | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 13dec5dac9..006584c954 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -268,7 +268,7 @@ function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, Sw if (\is_null($runtime)) { throw new AppwriteException(AppwriteException::FUNCTION_RUNTIME_UNSUPPORTED, 'Runtime "' . $resource->getAttribute('runtime', '') . '" is not supported'); } - + $allowAnyStatus = !\is_null($apiKey) && $apiKey->isDeploymentStatusIgnored(); if (!$allowAnyStatus && $deployment->getAttribute('status') !== 'ready') { throw new AppwriteException(AppwriteException::BUILD_NOT_READY); diff --git a/src/Appwrite/Auth/Key.php b/src/Appwrite/Auth/Key.php index 87e77b2e06..44a75a6ee3 100644 --- a/src/Appwrite/Auth/Key.php +++ b/src/Appwrite/Auth/Key.php @@ -79,7 +79,7 @@ class Key { return $this->previewAuthDisabled; } - + public function isDeploymentStatusIgnored(): bool { return $this->deploymentStatusIgnored; diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index 849fd514d0..b18b6e4004 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -778,7 +778,7 @@ class Builds extends Action } $executor->deleteRuntime($project->getId(), $deployment->getId(), '-build'); - + /** Update the build document */ $deployment->setAttribute('buildStartAt', DateTime::format((new \DateTime())->setTimestamp(floor($response['startTime'])))); $deployment->setAttribute('buildEndAt', $endTime); @@ -786,18 +786,18 @@ class Builds extends Action $deployment->setAttribute('buildPath', $response['path']); $deployment->setAttribute('buildSize', $response['size']); $deployment->setAttribute('totalSize', $deployment->getAttribute('buildSize', 0) + $deployment->getAttribute('sourceSize', 0)); - + $logs = ''; foreach ($response['output'] as $log) { $logs .= $log['content']; } $logs .= "Capturing screenshots ...\n"; $deployment->setAttribute('buildLogs', $logs); - + $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment); $deployment = $dbForProject->updateDocument('deployments', $deploymentId, $deployment); - + if ($deployment->getInternalId() === $resource->getAttribute('latestDeploymentInternalId', '')) { $resource = $resource->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); $dbForProject->updateDocument($resource->getCollection(), $resource->getId(), $resource); @@ -806,7 +806,7 @@ class Builds extends Action $queueForRealtime ->setPayload($deployment->getArrayCopy()) ->trigger(); - + /** Screenshot site */ if ($resource->getCollection() === 'sites') { try { @@ -1083,7 +1083,7 @@ class Builds extends Action Console::error($th->getFile()); Console::error($th->getLine()); Console::error($th->getTraceAsString()); - + if ($dbForProject->getDocument('deployments', $deploymentId)->getAttribute('status') === 'canceled') { Console::info('Build has been canceled'); return;