diff --git a/src/Appwrite/CLI/Tasks/volume-sync.php b/src/Appwrite/CLI/Tasks/VolumeSync.php similarity index 58% rename from src/Appwrite/CLI/Tasks/volume-sync.php rename to src/Appwrite/CLI/Tasks/VolumeSync.php index 8d5fec201b..3fd84c7d22 100644 --- a/src/Appwrite/CLI/Tasks/volume-sync.php +++ b/src/Appwrite/CLI/Tasks/VolumeSync.php @@ -4,16 +4,29 @@ global $cli; use Utopia\CLI\Console; use Utopia\Database\DateTime; +use Utopia\Platform\Action; use Utopia\Validator\Integer; use Utopia\Validator\Text; -$cli - ->task('volume-sync') - ->desc('Runs rsync to sync certificates between the storage mount and traefik.') - ->param('source', null, new Text(255), 'Source path to sync from.', false) - ->param('destination', null, new Text(255), 'Destination path to sync to.', false) - ->param('interval', null, new Integer(true), 'Interval to run rsync', false) - ->action(function ($source, $destination, $interval) { +class VolumeSync extends Action +{ + public static function getName(): string + { + return 'volume-sync'; + } + + public function __construct() + { + $this + ->desc('Runs rsync to sync certificates between the storage mount and traefik.') + ->param('source', null, new Text(255), 'Source path to sync from.', false) + ->param('destination', null, new Text(255), 'Destination path to sync to.', false) + ->param('interval', null, new Integer(true), 'Interval to run rsync', false) + ->callback(fn ($source, $destination, $interval) => $this->action($source, $destination, $interval)); + } + + public function action(string $source, string $destination, int $interval) + { Console::title('RSync V1'); Console::success(APP_NAME . ' rsync process v1 has started'); @@ -42,4 +55,5 @@ $cli Console::success($stdout); Console::error($stderr); }, $interval); - }); + } +} diff --git a/src/Appwrite/CLI/TasksService.php b/src/Appwrite/CLI/TasksService.php index c6dba81dbc..12617ec33f 100644 --- a/src/Appwrite/CLI/TasksService.php +++ b/src/Appwrite/CLI/TasksService.php @@ -13,6 +13,7 @@ use Appwrite\CLI\Tasks\SSL; use Appwrite\CLI\Tasks\Usage; use Appwrite\CLI\Tasks\Vars; use Appwrite\CLI\Tasks\Version; +use VolumeSync; class TasksService extends Service { @@ -29,6 +30,7 @@ class TasksService extends Service ->addAction(Maintenance::getName(), new Maintenance()) ->addAction(Migrate::getName(), new Migrate()) ->addAction(SDKs::getName(), new SDKs()) + ->addAction(VolumeSync::getName(), new VolumeSync()) ->addAction(Specs::getName(), new Specs()); } }