fix: use named arguments for Sites/Functions create + createVariable

SDK 23.1 inserted \$startCommand between \$buildCommand and
\$outputDirectory in Sites::create, which silently shifted positional
calls — outputDirectory landed in startCommand and adapter landed in
outputDirectory, causing testAppwriteMigrationSite to migrate sites
with empty adapter. Fixed by switching to named arguments.

Apply the same to:
- Functions::create
- Functions::createVariable
- Sites::createVariable

Named args are robust against future positional insertions in the
generated SDK.
This commit is contained in:
Prem Palanisamy committed 2026-05-10 05:07:41 +01:00
1 parent 0e88268d10
commit 6deabc6654
1 file changed
+31 -31
+31 -31
View File
@@ -2307,18 +2307,18 @@ class Appwrite extends Destination
}; };
$this->functions->create( $this->functions->create(
$resource->getId(), functionId: $resource->getId(),
$resource->getFunctionName(), name: $resource->getFunctionName(),
$runtime, runtime: $runtime,
$resource->getExecute(), execute: $resource->getExecute(),
$resource->getEvents(), events: $resource->getEvents(),
$resource->getSchedule(), schedule: $resource->getSchedule(),
$resource->getTimeout(), timeout: $resource->getTimeout(),
$resource->getEnabled(), enabled: $resource->getEnabled(),
$resource->getLogging(), logging: $resource->getLogging(),
$resource->getEntrypoint(), entrypoint: $resource->getEntrypoint(),
$resource->getCommands(), commands: $resource->getCommands(),
$resource->getScopes(), scopes: $resource->getScopes(),
buildSpecification: $resource->getSpecification() ?: null, buildSpecification: $resource->getSpecification() ?: null,
runtimeSpecification: $resource->getSpecification() ?: null, runtimeSpecification: $resource->getSpecification() ?: null,
); );
@@ -2326,10 +2326,10 @@ class Appwrite extends Destination
case Resource::TYPE_ENVIRONMENT_VARIABLE: case Resource::TYPE_ENVIRONMENT_VARIABLE:
/** @var EnvVar $resource */ /** @var EnvVar $resource */
$this->functions->createVariable( $this->functions->createVariable(
$resource->getFunc()->getId(), functionId: $resource->getFunc()->getId(),
$resource->getId(), variableId: $resource->getId(),
$resource->getKey(), key: $resource->getKey(),
$resource->getValue() value: $resource->getValue(),
); );
break; break;
case Resource::TYPE_DEPLOYMENT: case Resource::TYPE_DEPLOYMENT:
@@ -2557,17 +2557,17 @@ class Appwrite extends Destination
}; };
$this->sites->create( $this->sites->create(
$resource->getId(), siteId: $resource->getId(),
$resource->getSiteName(), name: $resource->getSiteName(),
$framework, framework: $framework,
$buildRuntime, buildRuntime: $buildRuntime,
$resource->getEnabled(), enabled: $resource->getEnabled(),
$resource->getLogging(), logging: $resource->getLogging(),
$resource->getTimeout(), timeout: $resource->getTimeout(),
$resource->getInstallCommand(), installCommand: $resource->getInstallCommand(),
$resource->getBuildCommand(), buildCommand: $resource->getBuildCommand(),
$resource->getOutputDirectory(), outputDirectory: $resource->getOutputDirectory(),
$adapter, adapter: $adapter,
fallbackFile: $resource->getFallbackFile(), fallbackFile: $resource->getFallbackFile(),
buildSpecification: $resource->getSpecification() ?: null, buildSpecification: $resource->getSpecification() ?: null,
runtimeSpecification: $resource->getSpecification() ?: null, runtimeSpecification: $resource->getSpecification() ?: null,
@@ -2576,10 +2576,10 @@ class Appwrite extends Destination
case Resource::TYPE_SITE_VARIABLE: case Resource::TYPE_SITE_VARIABLE:
/** @var SiteEnvVar $resource */ /** @var SiteEnvVar $resource */
$this->sites->createVariable( $this->sites->createVariable(
$resource->getSite()->getId(), siteId: $resource->getSite()->getId(),
$resource->getId(), variableId: $resource->getId(),
$resource->getKey(), key: $resource->getKey(),
$resource->getValue() value: $resource->getValue(),
); );
break; break;
case Resource::TYPE_SITE_DEPLOYMENT: case Resource::TYPE_SITE_DEPLOYMENT: