From 726d62654372dfec79bcc34a82899bd7a6e5dd2a Mon Sep 17 00:00:00 2001 From: Pranjal Goyal Date: Sat, 8 Apr 2023 22:11:23 +0530 Subject: [PATCH 01/11] Added Documentation change on static files --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index beaa176249..f65bd36e37 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -109,7 +109,7 @@ docker run --rm --interactive --tty \ ### User Interface -Appwrite uses an internal micro-framework called Litespeed.js to build simple UI components in vanilla JS and [less](http://lesscss.org/) for compiling CSS code. To apply any of your changes to the UI, use the `gulp build` or `gulp less` commands, and restart the Appwrite main container to load the new static files to memory using `docker compose restart appwrite`. +Appwrite UI is built with two frameworks [Svelte](https://svelte.dev/) and [Svelte Kit](https://kit.svelte.dev/). You can refer the repo [Appwrite-Console](https://github.com/appwrite/console) to learn and explore. ### Get Started From 977d67a4f895ec2bb21680b454b6cf5035eb5f17 Mon Sep 17 00:00:00 2001 From: Pranjal Goyal Date: Thu, 20 Apr 2023 16:49:38 +0530 Subject: [PATCH 02/11] Updated Documentation on Pink and Contribution Gd --- CONTRIBUTING.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f65bd36e37..9651c99242 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -109,7 +109,9 @@ docker run --rm --interactive --tty \ ### User Interface -Appwrite UI is built with two frameworks [Svelte](https://svelte.dev/) and [Svelte Kit](https://kit.svelte.dev/). You can refer the repo [Appwrite-Console](https://github.com/appwrite/console) to learn and explore. +Appwrite UI is built with two frameworks [Svelte](https://svelte.dev/) and [Svelte Kit](https://kit.svelte.dev/). You can refer the repo [Appwrite-Console](https://github.com/appwrite/console) to learn and explore. Appwrite is using [Pink](https://github.com/appwrite/pink) for CSS. + +To contribute to the UI, head over to the [Contribution Guide](https://github.com/appwrite/console/blob/main/CONTRIBUTING.md) ### Get Started From fbacd412e9cd4f65c208edc54214c5bea60882e2 Mon Sep 17 00:00:00 2001 From: Pranjal Goyal Date: Fri, 21 Apr 2023 08:27:24 +0530 Subject: [PATCH 03/11] Updated and Resolved Comments --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9651c99242..59a7b01469 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -109,9 +109,9 @@ docker run --rm --interactive --tty \ ### User Interface -Appwrite UI is built with two frameworks [Svelte](https://svelte.dev/) and [Svelte Kit](https://kit.svelte.dev/). You can refer the repo [Appwrite-Console](https://github.com/appwrite/console) to learn and explore. Appwrite is using [Pink](https://github.com/appwrite/pink) for CSS. +Appwrite's UI is built with [Svelte](https://svelte.dev/), [Svelte Kit](https://kit.svelte.dev/), and the [Pink Design](https://github.com/appwrite/pink) component library. You can find the source code in the [Appwrite Console](https://github.com/appwrite/console) repository. -To contribute to the UI, head over to the [Contribution Guide](https://github.com/appwrite/console/blob/main/CONTRIBUTING.md) +To contribute to the UI, head to the [Contribution Guide](https://github.com/appwrite/console/blob/main/CONTRIBUTING.md) of Appwrite Console. ### Get Started From 13066c3dde6ac525743bf6c166a881a91f73ef9c Mon Sep 17 00:00:00 2001 From: shimon Date: Tue, 13 Jun 2023 14:11:23 +0300 Subject: [PATCH 04/11] cache deletion bug fix --- app/controllers/api/storage.php | 10 +++--- app/workers/deletes.php | 64 ++++++++++++++++++++++----------- 2 files changed, 49 insertions(+), 25 deletions(-) diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index d59d950d93..7d64f752f3 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -654,11 +654,6 @@ App::post('/v1/storage/buckets/:bucketId/files') ->setContext('bucket', $bucket) ; - $deletes - ->setType(DELETE_TYPE_CACHE_BY_RESOURCE) - ->setResource('file/' . $file->getId()) - ; - $metadata = null; // was causing leaks as it was passed by reference $response @@ -1341,6 +1336,11 @@ App::put('/v1/storage/buckets/:bucketId/files/:fileId') $file = Authorization::skip(fn() => $dbForProject->updateDocument('bucket_' . $bucket->getInternalId(), $fileId, $file)); } + $deletes + ->setType(DELETE_TYPE_CACHE_BY_RESOURCE) + ->setResource('file/' . $file->getId()) + ; + $events ->setParam('bucketId', $bucket->getId()) ->setParam('fileId', $file->getId()) diff --git a/app/workers/deletes.php b/app/workers/deletes.php index f27bc4feb9..e2a314ee98 100644 --- a/app/workers/deletes.php +++ b/app/workers/deletes.php @@ -114,10 +114,10 @@ class DeletesV1 extends Worker break; case DELETE_TYPE_CACHE_BY_RESOURCE: - $this->deleteCacheByResource($project->getId()); + $this->deleteCacheByResource($project, $this->args['resource']); break; case DELETE_TYPE_CACHE_BY_TIMESTAMP: - $this->deleteCacheByDate(); + $this->deleteCacheByDate($this->args['datetime']); break; default: Console::error('No delete operation for type: ' . $type); @@ -130,31 +130,55 @@ class DeletesV1 extends Worker } /** - * @param string $projectId + * @param Document $project + * @param string $resource + * @throws Exception */ - protected function deleteCacheByResource(string $projectId): void + protected function deleteCacheByResource(Document $project, string $resource): void { - $this->deleteCacheFiles([ - Query::equal('resource', [$this->args['resource']]), - ]); - } + $dbForProject = $this->getProjectDB($project); + $projectId = $project->getId(); + $document = $dbForProject->findOne('cache', [Query::equal('resource', [$resource])]); - protected function deleteCacheByDate(): void - { - $this->deleteCacheFiles([ - Query::lessThan('accessedAt', $this->args['datetime']), - ]); - } - - protected function deleteCacheFiles($query): void - { - $this->deleteForProjectIds(function (string $projectId) use ($query) { - - $dbForProject = $this->getProjectDB($projectId); + if ($document) { $cache = new Cache( new Filesystem(APP_STORAGE_CACHE . DIRECTORY_SEPARATOR . 'app-' . $projectId) ); + $this->deleteById( + $document, + $dbForProject, + function ($document) use ($cache, $projectId) { + $path = APP_STORAGE_CACHE . DIRECTORY_SEPARATOR . 'app-' . $projectId . DIRECTORY_SEPARATOR . $document->getId(); + + if ($cache->purge($document->getId())) { + Console::success('Deleting cache file: ' . $path); + } else { + Console::error('Failed to delete cache file: ' . $path); + } + } + ); + } + } + + /** + * @param string $datetime + * @throws Exception + */ + protected function deleteCacheByDate(string $datetime): void + { + $this->deleteForProjectIds(function (Document $project) use ($datetime) { + + $projectId = $project->getId(); + $dbForProject = $this->getProjectDB($project); + $cache = new Cache( + new Filesystem(APP_STORAGE_CACHE . DIRECTORY_SEPARATOR . 'app-' . $projectId) + ); + + $query = [ + Query::lessThan('accessedAt', $datetime), + ]; + $this->deleteByGroup( 'cache', $query, From 7e95f529a619adbaa36ae6afd8c0e37c9da5179e Mon Sep 17 00:00:00 2001 From: shimon Date: Tue, 13 Jun 2023 14:33:26 +0300 Subject: [PATCH 05/11] cache deletion bug fix --- app/controllers/api/storage.php | 8 +------- app/workers/deletes.php | 3 ++- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index 7d64f752f3..a4063d7fa3 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -359,8 +359,7 @@ App::post('/v1/storage/buckets/:bucketId/files') ->inject('mode') ->inject('deviceFiles') ->inject('deviceLocal') - ->inject('deletes') - ->action(function (string $bucketId, string $fileId, mixed $file, ?array $permissions, Request $request, Response $response, Database $dbForProject, Document $user, Event $events, string $mode, Device $deviceFiles, Device $deviceLocal, Delete $deletes) { + ->action(function (string $bucketId, string $fileId, mixed $file, ?array $permissions, Request $request, Response $response, Database $dbForProject, Document $user, Event $events, string $mode, Device $deviceFiles, Device $deviceLocal) { $bucket = Authorization::skip(fn () => $dbForProject->getDocument('buckets', $bucketId)); @@ -1336,11 +1335,6 @@ App::put('/v1/storage/buckets/:bucketId/files/:fileId') $file = Authorization::skip(fn() => $dbForProject->updateDocument('bucket_' . $bucket->getInternalId(), $fileId, $file)); } - $deletes - ->setType(DELETE_TYPE_CACHE_BY_RESOURCE) - ->setResource('file/' . $file->getId()) - ; - $events ->setParam('bucketId', $bucket->getId()) ->setParam('fileId', $file->getId()) diff --git a/app/workers/deletes.php b/app/workers/deletes.php index e2a314ee98..fbd851ebf7 100644 --- a/app/workers/deletes.php +++ b/app/workers/deletes.php @@ -136,8 +136,9 @@ class DeletesV1 extends Worker */ protected function deleteCacheByResource(Document $project, string $resource): void { - $dbForProject = $this->getProjectDB($project); + $projectId = $project->getId(); + $dbForProject = $this->getProjectDB($project->getId()); $document = $dbForProject->findOne('cache', [Query::equal('resource', [$resource])]); if ($document) { From 8e0457a30788debf5b65de3d714a1b4878e16a11 Mon Sep 17 00:00:00 2001 From: shimon Date: Tue, 13 Jun 2023 14:53:12 +0300 Subject: [PATCH 06/11] cache deletion bug fix --- app/workers/deletes.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/workers/deletes.php b/app/workers/deletes.php index fbd851ebf7..1c2ffa4cea 100644 --- a/app/workers/deletes.php +++ b/app/workers/deletes.php @@ -168,10 +168,9 @@ class DeletesV1 extends Worker */ protected function deleteCacheByDate(string $datetime): void { - $this->deleteForProjectIds(function (Document $project) use ($datetime) { + $this->deleteForProjectIds(function (string $projectId) use ($datetime) { - $projectId = $project->getId(); - $dbForProject = $this->getProjectDB($project); + $dbForProject = $this->getProjectDB($projectId); $cache = new Cache( new Filesystem(APP_STORAGE_CACHE . DIRECTORY_SEPARATOR . 'app-' . $projectId) ); From f2b5607074a6b6aa0bb9a3c2947767eb971bd12b Mon Sep 17 00:00:00 2001 From: shimon Date: Tue, 13 Jun 2023 17:06:47 +0300 Subject: [PATCH 07/11] cache deletion bug fix --- app/workers/deletes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/workers/deletes.php b/app/workers/deletes.php index 1c2ffa4cea..39bd1c9954 100644 --- a/app/workers/deletes.php +++ b/app/workers/deletes.php @@ -138,7 +138,7 @@ class DeletesV1 extends Worker { $projectId = $project->getId(); - $dbForProject = $this->getProjectDB($project->getId()); + $dbForProject = $this->getProjectDB($projectId); $document = $dbForProject->findOne('cache', [Query::equal('resource', [$resource])]); if ($document) { From b7aab21698e2238d4a914975c0f6cae0a3ec01e0 Mon Sep 17 00:00:00 2001 From: shimon Date: Thu, 13 Jul 2023 13:36:14 +0300 Subject: [PATCH 08/11] cache deleteById to deleteByGroup --- app/workers/deletes.php | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/app/workers/deletes.php b/app/workers/deletes.php index 39bd1c9954..f3876ba9c8 100644 --- a/app/workers/deletes.php +++ b/app/workers/deletes.php @@ -136,30 +136,31 @@ class DeletesV1 extends Worker */ protected function deleteCacheByResource(Document $project, string $resource): void { - $projectId = $project->getId(); - $dbForProject = $this->getProjectDB($projectId); - $document = $dbForProject->findOne('cache', [Query::equal('resource', [$resource])]); + $dbForProject = $this->getProjectDB($project); - if ($document) { - $cache = new Cache( - new Filesystem(APP_STORAGE_CACHE . DIRECTORY_SEPARATOR . 'app-' . $projectId) - ); + $cache = new Cache( + new Filesystem(APP_STORAGE_CACHE . DIRECTORY_SEPARATOR . 'app-' . $projectId) + ); - $this->deleteById( - $document, - $dbForProject, - function ($document) use ($cache, $projectId) { - $path = APP_STORAGE_CACHE . DIRECTORY_SEPARATOR . 'app-' . $projectId . DIRECTORY_SEPARATOR . $document->getId(); + $query = [ + Query::equal('resource', [$resource]) + ]; - if ($cache->purge($document->getId())) { - Console::success('Deleting cache file: ' . $path); - } else { - Console::error('Failed to delete cache file: ' . $path); - } + $this->deleteByGroup( + 'cache', + $query, + $dbForProject, + function (Document $document) use ($cache, $projectId) { + $path = APP_STORAGE_CACHE . DIRECTORY_SEPARATOR . 'app-' . $projectId . DIRECTORY_SEPARATOR . $document->getId(); + + if ($cache->purge($document->getId())) { + Console::success('Deleting cache file: ' . $path); + } else { + Console::error('Failed to delete cache file: ' . $path); } - ); - } + } + ); } /** From ee6ddc89dc7b2d636ec5b736c0c6ab291e5db5cb Mon Sep 17 00:00:00 2001 From: shimon Date: Thu, 13 Jul 2023 13:53:35 +0300 Subject: [PATCH 09/11] cache deleteById to deleteByGroup --- app/workers/deletes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/workers/deletes.php b/app/workers/deletes.php index f3876ba9c8..8fb23de4e1 100644 --- a/app/workers/deletes.php +++ b/app/workers/deletes.php @@ -137,7 +137,7 @@ class DeletesV1 extends Worker protected function deleteCacheByResource(Document $project, string $resource): void { $projectId = $project->getId(); - $dbForProject = $this->getProjectDB($project); + $dbForProject = $this->getProjectDB($projectId); $cache = new Cache( new Filesystem(APP_STORAGE_CACHE . DIRECTORY_SEPARATOR . 'app-' . $projectId) From 330272122479e86647ddf852a7bc28ed00d633c1 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Tue, 25 Jul 2023 15:46:57 +0000 Subject: [PATCH 10/11] Update Akamai integration further according to their latest rebrand --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2b82d49eb0..fa20a12dbb 100644 --- a/README.md +++ b/README.md @@ -131,7 +131,7 @@ Choose from one of the providers below: Akamai Logo -
Akamai
+
Akamai Compute From b8e840f42dbbf4d63810a8c6ffac2094ea99d86b Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 31 Jul 2023 16:01:59 +0000 Subject: [PATCH 11/11] Fix missing description for endpoint --- docs/references/functions/create-build.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/references/functions/create-build.md diff --git a/docs/references/functions/create-build.md b/docs/references/functions/create-build.md new file mode 100644 index 0000000000..31a288a35a --- /dev/null +++ b/docs/references/functions/create-build.md @@ -0,0 +1 @@ +Create a new build for an Appwrite Function deployment. This endpoint can be used to retry a failed build. \ No newline at end of file