Simplify callback syntax in tasks

This commit is contained in:
Khushboo Verma
2025-03-12 16:55:48 +05:30
parent 42cd1df77d
commit 39699d16ba
11 changed files with 11 additions and 15 deletions
+1 -1
View File
@@ -28,7 +28,7 @@ class Doctor extends Action
$this
->desc('Validate server health')
->inject('register')
->callback(fn (Registry $register) => $this->action($register));
->callback([$this, 'action']);
}
public function action(Registry $register): void
+1 -1
View File
@@ -31,7 +31,7 @@ class Install extends Action
->param('image', 'appwrite', new Text(0), 'Main appwrite docker image', true)
->param('interactive', 'Y', new Text(1), 'Run an interactive session', true)
->param('no-start', false, new Boolean(true), 'Run an interactive session', true)
->callback(fn ($httpPort, $httpsPort, $organization, $image, $interactive, $noStart) => $this->action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart));
->callback([$this, 'action']);
}
public function action(string $httpPort, string $httpsPort, string $organization, string $image, string $interactive, bool $noStart): void
+1 -1
View File
@@ -26,7 +26,7 @@ class Maintenance extends Action
->inject('dbForPlatform')
->inject('queueForCertificates')
->inject('queueForDeletes')
->callback(fn (Database $dbForPlatform, Certificate $queueForCertificates, Delete $queueForDeletes) => $this->action($dbForPlatform, $queueForCertificates, $queueForDeletes));
->callback([$this, 'action']);
}
public function action(Database $dbForPlatform, Certificate $queueForCertificates, Delete $queueForDeletes): void
+1 -5
View File
@@ -33,11 +33,7 @@ class Migrate extends Action
->inject('dbForPlatform')
->inject('getProjectDB')
->inject('register')
->callback(function ($version, $dbForPlatform, $getProjectDB, Registry $register) {
\Co\run(function () use ($version, $dbForPlatform, $getProjectDB, $register) {
$this->action($version, $dbForPlatform, $getProjectDB, $register);
});
});
->callback([$this, 'action']);
}
private function clearProjectsCache(Document $project)
+1 -1
View File
@@ -24,7 +24,7 @@ class QueueRetry extends Action
->param('name', '', new Text(100), 'Queue name')
->param('limit', 0, new Wildcard(), 'jobs limit', true)
->inject('publisher')
->callback(fn ($name, $limit, $publisher) => $this->action($name, $limit, $publisher));
->callback([$this, 'action']);
}
/**
+1 -1
View File
@@ -24,7 +24,7 @@ class SSL extends Action
->param('domain', System::getEnv('_APP_DOMAIN', ''), new Hostname(), 'Domain to generate certificate for. If empty, main domain will be used.', true)
->param('skip-check', true, new Boolean(true), 'If DNS and renew check should be skipped. Defaults to true, and when true, all jobs will result in certificate generation attempt.', true)
->inject('queueForCertificates')
->callback(fn (string $domain, bool|string $skipCheck, Certificate $queueForCertificates) => $this->action($domain, $skipCheck, $queueForCertificates));
->callback([$this, 'action']);
}
public function action(string $domain, bool|string $skipCheck, Certificate $queueForCertificates): void
+1 -1
View File
@@ -37,7 +37,7 @@ abstract class ScheduleBase extends Action
->inject('pools')
->inject('dbForPlatform')
->inject('getProjectDB')
->callback(fn (Group $pools, Database $dbForPlatform, callable $getProjectDB) => $this->action($pools, $dbForPlatform, $getProjectDB));
->callback([$this, 'action']);
}
protected function updateProjectAccess(Document $project, Database $dbForPlatform): void
+1 -1
View File
@@ -21,7 +21,7 @@ class Screenshot extends Action
$this
->desc('Create Site template screenshot')
->param('templateId', '', new Text(128), 'Template ID.')
->callback(fn (string $templateId) => $this->action($templateId));
->callback([$this, 'action']);
}
public function action(string $templateId): void
+1 -1
View File
@@ -50,7 +50,7 @@ class Specs extends Action
->param('version', 'latest', new Text(16), 'Spec version', true)
->param('mode', 'normal', new WhiteList(['normal', 'mocks']), 'Spec Mode', true)
->inject('register')
->callback(fn (string $version, string $mode, Registry $register) => $this->action($version, $mode, $register));
->callback([$this, 'action']);
}
public function action(string $version, string $mode, Registry $register): void
+1 -1
View File
@@ -23,7 +23,7 @@ class Upgrade extends Install
->param('image', 'appwrite', new Text(0), 'Main appwrite docker image', true)
->param('interactive', 'Y', new Text(1), 'Run an interactive session', true)
->param('no-start', false, new Boolean(true), 'Run an interactive session', true)
->callback(fn ($httpPort, $httpsPort, $organization, $image, $interactive, $noStart) => $this->action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart));
->callback([$this, 'action']);
}
public function action(string $httpPort, string $httpsPort, string $organization, string $image, string $interactive, bool $noStart): void
+1 -1
View File
@@ -18,7 +18,7 @@ class Vars extends Action
{
$this
->desc('List all the server environment variables')
->callback(fn () => $this->action());
->callback([$this, 'action']);
}
public function action(): void