From e225bbe3c911e681b4f40249f03dfe16990098d1 Mon Sep 17 00:00:00 2001 From: shimon Date: Wed, 14 Jun 2023 17:42:23 +0300 Subject: [PATCH 01/11] delete unnecessary project collections task --- Dockerfile | 1 + app/console | 2 +- bin/delete-project-collections | 3 + src/Appwrite/Platform/Services/Tasks.php | 2 + .../Tasks/DeleteProjectCollections.php | 129 ++++++++++++++++++ 5 files changed, 136 insertions(+), 1 deletion(-) create mode 100644 bin/delete-project-collections create mode 100644 src/Appwrite/Platform/Tasks/DeleteProjectCollections.php diff --git a/Dockerfile b/Dockerfile index b0ae0248e5..0239b308d9 100755 --- a/Dockerfile +++ b/Dockerfile @@ -121,6 +121,7 @@ RUN chmod +x /usr/local/bin/doctor && \ chmod +x /usr/local/bin/clear-card-cache && \ chmod +x /usr/local/bin/calc-users-stats && \ chmod +x /usr/local/bin/calc-tier-stats && \ + chmod +x /usr/local/bin/delete-project-collections && \ chmod +x /usr/local/bin/maintenance && \ chmod +x /usr/local/bin/volume-sync && \ chmod +x /usr/local/bin/usage && \ diff --git a/app/console b/app/console index b981302dee..cad6f3b1bf 160000 --- a/app/console +++ b/app/console @@ -1 +1 @@ -Subproject commit b981302dee30eab33e155af79f0088822b29a2b6 +Subproject commit cad6f3b1bfdae4d423ba6f0735ba2a5cd5a58551 diff --git a/bin/delete-project-collections b/bin/delete-project-collections new file mode 100644 index 0000000000..3991342962 --- /dev/null +++ b/bin/delete-project-collections @@ -0,0 +1,3 @@ +#!/bin/sh + +php /usr/src/code/app/cli.php delete-project-collections $@ \ No newline at end of file diff --git a/src/Appwrite/Platform/Services/Tasks.php b/src/Appwrite/Platform/Services/Tasks.php index 7e8d9a1333..fc40049f7c 100644 --- a/src/Appwrite/Platform/Services/Tasks.php +++ b/src/Appwrite/Platform/Services/Tasks.php @@ -21,6 +21,7 @@ use Appwrite\Platform\Tasks\Version; use Appwrite\Platform\Tasks\VolumeSync; use Appwrite\Platform\Tasks\CalcUsersStats; use Appwrite\Platform\Tasks\CalcTierStats; +use Appwrite\Platform\Tasks\DeleteProjectCollections; class Tasks extends Service { @@ -46,6 +47,7 @@ class Tasks extends Service ->addAction(Specs::getName(), new Specs()) ->addAction(CalcUsersStats::getName(), new CalcUsersStats()) ->addAction(CalcTierStats::getName(), new CalcTierStats()) + ->addAction(DeleteProjectCollections::getName(), new DeleteProjectCollections()) ; } } diff --git a/src/Appwrite/Platform/Tasks/DeleteProjectCollections.php b/src/Appwrite/Platform/Tasks/DeleteProjectCollections.php new file mode 100644 index 0000000000..a083caeab2 --- /dev/null +++ b/src/Appwrite/Platform/Tasks/DeleteProjectCollections.php @@ -0,0 +1,129 @@ +desc('Delete unnecessary project collections') + ->inject('pools') + ->inject('cache') + ->inject('dbForConsole') + ->inject('register') + ->callback(function (Group $pools, Cache $cache, Database $dbForConsole, Registry $register) { + $this->action($pools, $cache, $dbForConsole, $register); + }); + } + + public function action(Group $pools, Cache $cache, Database $dbForConsole, Registry $register): void + { + //docker compose exec -t appwrite delete-project-collections + + Console::title('Cloud Users calculation V1'); + Console::success(APP_NAME . ' cloud Users calculation has started'); + + /* Initialise new Utopia app */ + $app = new App('UTC'); + $console = $app->getResource('console'); + + /** Database connections */ + $totalProjects = $dbForConsole->count('projects'); + Console::success("Found a total of: {$totalProjects} projects"); + + $projects = [$console]; + $count = 0; + $limit = 30; + $sum = 30; + $offset = 0; + while (!empty($projects)) { + foreach ($projects as $project) { + + /** + * Skip user projects with id 'console' + */ + if ($project->getId() === 'console') { + continue; + } + + Console::info("Getting stats for {$project->getId()}"); + + try { + $db = $project->getAttribute('database'); + $adapter = $pools + ->get($db) + ->pop() + ->getResource(); + + $dbForProject = new Database($adapter, $cache); + $dbForProject->setDefaultDatabase('appwrite'); + $dbForProject->setNamespace('_' . $project->getInternalId()); + + foreach ($this->names as $name) { + if ($dbForProject->exists('appwrite', $name)) { + if ($dbForProject->deleteCollection($name)) { + Console::log('Deleted ' . $name); + } else { + Console::error('Failed to delete ' . $name); + } + + if ($dbForProject->deleteCachedCollection($name)) { + Console::log('Deleted (cached) ' . $name); + } else { + Console::error('Failed to delete (cached) ' . $name); + } + } + } + } catch (\Throwable $th) { + Console::error('Failed on project ("' . $project->getId() . '") version with error: ' . $th->getMessage()); + } finally { + $pools + ->get($db) + ->reclaim(); + } + } + + $sum = \count($projects); + + $projects = $dbForConsole->find('projects', [ + Query::limit($limit), + Query::offset($offset), + ]); + + $offset = $offset + $limit; + $count = $count + $sum; + } + Console::log('Iterated through ' . $count - 1 . '/' . $totalProjects . ' projects...'); + $pools + ->get('console') + ->reclaim(); + } +} From 2432210bbbee72b94bfbb598662b25e2225d9492 Mon Sep 17 00:00:00 2001 From: shimon Date: Wed, 14 Jun 2023 17:45:18 +0300 Subject: [PATCH 02/11] delete unnecessary project collections task --- src/Appwrite/Platform/Tasks/DeleteProjectCollections.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Appwrite/Platform/Tasks/DeleteProjectCollections.php b/src/Appwrite/Platform/Tasks/DeleteProjectCollections.php index a083caeab2..c9a31d9057 100644 --- a/src/Appwrite/Platform/Tasks/DeleteProjectCollections.php +++ b/src/Appwrite/Platform/Tasks/DeleteProjectCollections.php @@ -15,7 +15,6 @@ class DeleteProjectCollections extends Action { private array $names = [ 'webhooks', - 'webhooks_perms', 'platforms', 'schedules', 'projects', From 56a337eac4a17ee584888d8bfead4672c1a731aa Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 14 Jun 2023 15:27:03 +0000 Subject: [PATCH 03/11] feat: update console --- app/console | 2 +- composer.lock | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/console b/app/console index cad6f3b1bf..b981302dee 160000 --- a/app/console +++ b/app/console @@ -1 +1 @@ -Subproject commit cad6f3b1bfdae4d423ba6f0735ba2a5cd5a58551 +Subproject commit b981302dee30eab33e155af79f0088822b29a2b6 diff --git a/composer.lock b/composer.lock index 4510e49ba7..aed1b97dd5 100644 --- a/composer.lock +++ b/composer.lock @@ -3070,16 +3070,16 @@ }, { "name": "matthiasmullie/minify", - "version": "1.3.70", + "version": "1.3.71", "source": { "type": "git", "url": "https://github.com/matthiasmullie/minify.git", - "reference": "2807d9f9bece6877577ad44acb5c801bb3ae536b" + "reference": "ae42a47d7fecc1fbb7277b2f2d84c37a33edc3b1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/2807d9f9bece6877577ad44acb5c801bb3ae536b", - "reference": "2807d9f9bece6877577ad44acb5c801bb3ae536b", + "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/ae42a47d7fecc1fbb7277b2f2d84c37a33edc3b1", + "reference": "ae42a47d7fecc1fbb7277b2f2d84c37a33edc3b1", "shasum": "" }, "require": { @@ -3129,7 +3129,7 @@ ], "support": { "issues": "https://github.com/matthiasmullie/minify/issues", - "source": "https://github.com/matthiasmullie/minify/tree/1.3.70" + "source": "https://github.com/matthiasmullie/minify/tree/1.3.71" }, "funding": [ { @@ -3137,7 +3137,7 @@ "type": "github" } ], - "time": "2022-12-09T12:56:44+00:00" + "time": "2023-04-25T20:33:03+00:00" }, { "name": "matthiasmullie/path-converter", @@ -5451,16 +5451,16 @@ }, { "name": "twig/twig", - "version": "v3.6.0", + "version": "v3.6.1", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "106c170d08e8415d78be2d16c3d057d0d108262b" + "reference": "7e7d5839d4bec168dfeef0ac66d5c5a2edbabffd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/106c170d08e8415d78be2d16c3d057d0d108262b", - "reference": "106c170d08e8415d78be2d16c3d057d0d108262b", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/7e7d5839d4bec168dfeef0ac66d5c5a2edbabffd", + "reference": "7e7d5839d4bec168dfeef0ac66d5c5a2edbabffd", "shasum": "" }, "require": { @@ -5506,7 +5506,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.6.0" + "source": "https://github.com/twigphp/Twig/tree/v3.6.1" }, "funding": [ { @@ -5518,7 +5518,7 @@ "type": "tidelift" } ], - "time": "2023-05-03T19:06:57+00:00" + "time": "2023-06-08T12:52:13+00:00" } ], "aliases": [], From 7196114339fcb6ef8b1963a13763aec317da5075 Mon Sep 17 00:00:00 2001 From: shimon Date: Wed, 14 Jun 2023 18:58:29 +0300 Subject: [PATCH 04/11] delete unnecessary project collections task --- src/Appwrite/Platform/Tasks/DeleteProjectCollections.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Platform/Tasks/DeleteProjectCollections.php b/src/Appwrite/Platform/Tasks/DeleteProjectCollections.php index c9a31d9057..00ed10adb5 100644 --- a/src/Appwrite/Platform/Tasks/DeleteProjectCollections.php +++ b/src/Appwrite/Platform/Tasks/DeleteProjectCollections.php @@ -47,8 +47,8 @@ class DeleteProjectCollections extends Action { //docker compose exec -t appwrite delete-project-collections - Console::title('Cloud Users calculation V1'); - Console::success(APP_NAME . ' cloud Users calculation has started'); + Console::title('Delete Project Tables V1'); + Console::success(APP_NAME . ' delete Project Tables'); /* Initialise new Utopia app */ $app = new App('UTC'); From f2705c30a3f461b20c5c6c461cb6d154bb089950 Mon Sep 17 00:00:00 2001 From: shimon Date: Wed, 14 Jun 2023 18:59:46 +0300 Subject: [PATCH 05/11] delete unnecessary project collections task --- src/Appwrite/Platform/Tasks/DeleteProjectCollections.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Platform/Tasks/DeleteProjectCollections.php b/src/Appwrite/Platform/Tasks/DeleteProjectCollections.php index 00ed10adb5..81056e296a 100644 --- a/src/Appwrite/Platform/Tasks/DeleteProjectCollections.php +++ b/src/Appwrite/Platform/Tasks/DeleteProjectCollections.php @@ -47,8 +47,8 @@ class DeleteProjectCollections extends Action { //docker compose exec -t appwrite delete-project-collections - Console::title('Delete Project Tables V1'); - Console::success(APP_NAME . ' delete Project Tables'); + Console::title('Delete project collections V1'); + Console::success(APP_NAME . ' delete project collections'); /* Initialise new Utopia app */ $app = new App('UTC'); From 3286279d3cabe3b9fc080fa200e411b35d0aa44e Mon Sep 17 00:00:00 2001 From: shimon Date: Wed, 14 Jun 2023 19:01:34 +0300 Subject: [PATCH 06/11] delete unnecessary project collections task --- src/Appwrite/Platform/Tasks/DeleteProjectCollections.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Appwrite/Platform/Tasks/DeleteProjectCollections.php b/src/Appwrite/Platform/Tasks/DeleteProjectCollections.php index 81056e296a..a430478c2f 100644 --- a/src/Appwrite/Platform/Tasks/DeleteProjectCollections.php +++ b/src/Appwrite/Platform/Tasks/DeleteProjectCollections.php @@ -60,8 +60,8 @@ class DeleteProjectCollections extends Action $projects = [$console]; $count = 0; - $limit = 30; - $sum = 30; + $limit = 50; + $sum = 50; $offset = 0; while (!empty($projects)) { foreach ($projects as $project) { @@ -73,7 +73,7 @@ class DeleteProjectCollections extends Action continue; } - Console::info("Getting stats for {$project->getId()}"); + Console::info("Deleting collections for {$project->getId()}"); try { $db = $project->getAttribute('database'); From 579a95aecc770fdc02a6b17b072d85eaa2ca8cec Mon Sep 17 00:00:00 2001 From: shimon Date: Wed, 14 Jun 2023 19:21:48 +0300 Subject: [PATCH 07/11] delete unnecessary project collections task --- src/Appwrite/Platform/Tasks/DeleteProjectCollections.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/Appwrite/Platform/Tasks/DeleteProjectCollections.php b/src/Appwrite/Platform/Tasks/DeleteProjectCollections.php index a430478c2f..db9c28eefb 100644 --- a/src/Appwrite/Platform/Tasks/DeleteProjectCollections.php +++ b/src/Appwrite/Platform/Tasks/DeleteProjectCollections.php @@ -93,12 +93,6 @@ class DeleteProjectCollections extends Action } else { Console::error('Failed to delete ' . $name); } - - if ($dbForProject->deleteCachedCollection($name)) { - Console::log('Deleted (cached) ' . $name); - } else { - Console::error('Failed to delete (cached) ' . $name); - } } } } catch (\Throwable $th) { From f5e9094bdc400adf281256c3b8fcd70312d03f34 Mon Sep 17 00:00:00 2001 From: shimon Date: Thu, 15 Jun 2023 09:51:11 +0300 Subject: [PATCH 08/11] delete unnecessary project collections task --- Dockerfile | 2 +- bin/delete-project-collections | 3 --- bin/patch-delete-project-collections | 3 +++ src/Appwrite/Platform/Services/Tasks.php | 4 ++-- ...lections.php => PatchDeleteProjectCollections.php} | 11 +++++++---- 5 files changed, 13 insertions(+), 10 deletions(-) delete mode 100644 bin/delete-project-collections create mode 100644 bin/patch-delete-project-collections rename src/Appwrite/Platform/Tasks/{DeleteProjectCollections.php => PatchDeleteProjectCollections.php} (92%) diff --git a/Dockerfile b/Dockerfile index 0239b308d9..f40d6475d1 100755 --- a/Dockerfile +++ b/Dockerfile @@ -121,7 +121,7 @@ RUN chmod +x /usr/local/bin/doctor && \ chmod +x /usr/local/bin/clear-card-cache && \ chmod +x /usr/local/bin/calc-users-stats && \ chmod +x /usr/local/bin/calc-tier-stats && \ - chmod +x /usr/local/bin/delete-project-collections && \ + chmod +x /usr/local/bin/patch-delete-project-collections && \ chmod +x /usr/local/bin/maintenance && \ chmod +x /usr/local/bin/volume-sync && \ chmod +x /usr/local/bin/usage && \ diff --git a/bin/delete-project-collections b/bin/delete-project-collections deleted file mode 100644 index 3991342962..0000000000 --- a/bin/delete-project-collections +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -php /usr/src/code/app/cli.php delete-project-collections $@ \ No newline at end of file diff --git a/bin/patch-delete-project-collections b/bin/patch-delete-project-collections new file mode 100644 index 0000000000..8bf0736cf3 --- /dev/null +++ b/bin/patch-delete-project-collections @@ -0,0 +1,3 @@ +#!/bin/sh + +php /usr/src/code/app/cli.php patch-delete-project-collections $@ \ No newline at end of file diff --git a/src/Appwrite/Platform/Services/Tasks.php b/src/Appwrite/Platform/Services/Tasks.php index fc40049f7c..10c573da42 100644 --- a/src/Appwrite/Platform/Services/Tasks.php +++ b/src/Appwrite/Platform/Services/Tasks.php @@ -21,7 +21,7 @@ use Appwrite\Platform\Tasks\Version; use Appwrite\Platform\Tasks\VolumeSync; use Appwrite\Platform\Tasks\CalcUsersStats; use Appwrite\Platform\Tasks\CalcTierStats; -use Appwrite\Platform\Tasks\DeleteProjectCollections; +use Appwrite\Platform\Tasks\PatchDeleteProjectCollections; class Tasks extends Service { @@ -47,7 +47,7 @@ class Tasks extends Service ->addAction(Specs::getName(), new Specs()) ->addAction(CalcUsersStats::getName(), new CalcUsersStats()) ->addAction(CalcTierStats::getName(), new CalcTierStats()) - ->addAction(DeleteProjectCollections::getName(), new DeleteProjectCollections()) + ->addAction(PatchDeleteProjectCollections::getName(), new PatchDeleteProjectCollections()) ; } } diff --git a/src/Appwrite/Platform/Tasks/DeleteProjectCollections.php b/src/Appwrite/Platform/Tasks/PatchDeleteProjectCollections.php similarity index 92% rename from src/Appwrite/Platform/Tasks/DeleteProjectCollections.php rename to src/Appwrite/Platform/Tasks/PatchDeleteProjectCollections.php index db9c28eefb..ac8e48b3ae 100644 --- a/src/Appwrite/Platform/Tasks/DeleteProjectCollections.php +++ b/src/Appwrite/Platform/Tasks/PatchDeleteProjectCollections.php @@ -11,7 +11,7 @@ use Utopia\Database\Query; use Utopia\Pools\Group; use Utopia\Registry\Registry; -class DeleteProjectCollections extends Action +class PatchDeleteProjectCollections extends Action { private array $names = [ 'webhooks', @@ -26,7 +26,7 @@ class DeleteProjectCollections extends Action public static function getName(): string { - return 'delete-project-collections'; + return 'patch-delete-project-collections'; } public function __construct() @@ -45,10 +45,10 @@ class DeleteProjectCollections extends Action public function action(Group $pools, Cache $cache, Database $dbForConsole, Registry $register): void { - //docker compose exec -t appwrite delete-project-collections + //docker compose exec -t appwrite patch-delete-project-collections Console::title('Delete project collections V1'); - Console::success(APP_NAME . ' delete project collections'); + Console::success(APP_NAME . ' delete project collections has started'); /* Initialise new Utopia app */ $app = new App('UTC'); @@ -87,6 +87,9 @@ class DeleteProjectCollections extends Action $dbForProject->setNamespace('_' . $project->getInternalId()); foreach ($this->names as $name) { + if (empty($name)) { + continue; + } if ($dbForProject->exists('appwrite', $name)) { if ($dbForProject->deleteCollection($name)) { Console::log('Deleted ' . $name); From ce596b2f2b4ef9cf062eafe7a2b6798363239157 Mon Sep 17 00:00:00 2001 From: shimon Date: Thu, 15 Jun 2023 11:53:19 +0300 Subject: [PATCH 09/11] delete unnecessary project collections task --- .../Tasks/PatchDeleteProjectCollections.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Appwrite/Platform/Tasks/PatchDeleteProjectCollections.php b/src/Appwrite/Platform/Tasks/PatchDeleteProjectCollections.php index ac8e48b3ae..8d6e22024f 100644 --- a/src/Appwrite/Platform/Tasks/PatchDeleteProjectCollections.php +++ b/src/Appwrite/Platform/Tasks/PatchDeleteProjectCollections.php @@ -9,7 +9,7 @@ use Utopia\CLI\Console; use Utopia\Database\Database; use Utopia\Database\Query; use Utopia\Pools\Group; -use Utopia\Registry\Registry; +use Utopia\Validator\Numeric; class PatchDeleteProjectCollections extends Action { @@ -34,16 +34,16 @@ class PatchDeleteProjectCollections extends Action $this ->desc('Delete unnecessary project collections') + ->param('pos', 0, new Numeric(), 'Resume deletion from param pos', true) ->inject('pools') ->inject('cache') ->inject('dbForConsole') - ->inject('register') - ->callback(function (Group $pools, Cache $cache, Database $dbForConsole, Registry $register) { - $this->action($pools, $cache, $dbForConsole, $register); + ->callback(function (int $pos, Group $pools, Cache $cache, Database $dbForConsole) { + $this->action($pos, $pools, $cache, $dbForConsole); }); } - public function action(Group $pools, Cache $cache, Database $dbForConsole, Registry $register): void + public function action(int $pos, Group $pools, Cache $cache, Database $dbForConsole): void { //docker compose exec -t appwrite patch-delete-project-collections @@ -62,7 +62,7 @@ class PatchDeleteProjectCollections extends Action $count = 0; $limit = 50; $sum = 50; - $offset = 0; + $offset = $pos; while (!empty($projects)) { foreach ($projects as $project) { @@ -114,6 +114,10 @@ class PatchDeleteProjectCollections extends Action Query::offset($offset), ]); + if (!empty($projects)) { + Console::log('Querying..... offset=' . $offset . ' , limit=' . $limit . ', count=' . $count); + } + $offset = $offset + $limit; $count = $count + $sum; } From 428e9e73fe121ae25e5e65d0660edf0e27d12981 Mon Sep 17 00:00:00 2001 From: shimon Date: Thu, 15 Jun 2023 11:59:43 +0300 Subject: [PATCH 10/11] delete unnecessary project collections task --- src/Appwrite/Platform/Tasks/PatchDeleteProjectCollections.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Platform/Tasks/PatchDeleteProjectCollections.php b/src/Appwrite/Platform/Tasks/PatchDeleteProjectCollections.php index 8d6e22024f..903fec23f4 100644 --- a/src/Appwrite/Platform/Tasks/PatchDeleteProjectCollections.php +++ b/src/Appwrite/Platform/Tasks/PatchDeleteProjectCollections.php @@ -83,14 +83,14 @@ class PatchDeleteProjectCollections extends Action ->getResource(); $dbForProject = new Database($adapter, $cache); - $dbForProject->setDefaultDatabase('appwrite'); + $dbForProject->setDefaultDatabase(App::getEnv('_APP_DB_SCHEMA', 'appwrite')); $dbForProject->setNamespace('_' . $project->getInternalId()); foreach ($this->names as $name) { if (empty($name)) { continue; } - if ($dbForProject->exists('appwrite', $name)) { + if ($dbForProject->exists(App::getEnv('_APP_DB_SCHEMA', 'appwrite'), $name)) { if ($dbForProject->deleteCollection($name)) { Console::log('Deleted ' . $name); } else { From e6333897074ab32dfdde147bfa98ce286784178f Mon Sep 17 00:00:00 2001 From: shimon Date: Thu, 15 Jun 2023 15:45:40 +0300 Subject: [PATCH 11/11] delete unnecessary project collections task --- .../Platform/Tasks/PatchDeleteProjectCollections.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Appwrite/Platform/Tasks/PatchDeleteProjectCollections.php b/src/Appwrite/Platform/Tasks/PatchDeleteProjectCollections.php index 903fec23f4..a909e68595 100644 --- a/src/Appwrite/Platform/Tasks/PatchDeleteProjectCollections.php +++ b/src/Appwrite/Platform/Tasks/PatchDeleteProjectCollections.php @@ -34,16 +34,16 @@ class PatchDeleteProjectCollections extends Action $this ->desc('Delete unnecessary project collections') - ->param('pos', 0, new Numeric(), 'Resume deletion from param pos', true) + ->param('offset', 0, new Numeric(), 'Resume deletion from param pos', true) ->inject('pools') ->inject('cache') ->inject('dbForConsole') - ->callback(function (int $pos, Group $pools, Cache $cache, Database $dbForConsole) { - $this->action($pos, $pools, $cache, $dbForConsole); + ->callback(function (int $offset, Group $pools, Cache $cache, Database $dbForConsole) { + $this->action($offset, $pools, $cache, $dbForConsole); }); } - public function action(int $pos, Group $pools, Cache $cache, Database $dbForConsole): void + public function action(int $offset, Group $pools, Cache $cache, Database $dbForConsole): void { //docker compose exec -t appwrite patch-delete-project-collections @@ -62,7 +62,7 @@ class PatchDeleteProjectCollections extends Action $count = 0; $limit = 50; $sum = 50; - $offset = $pos; + $offset = $offset; while (!empty($projects)) { foreach ($projects as $project) {