1
0
Fork 0
mirror of synced 2024-07-08 07:55:48 +12:00

Merge pull request #5699 from appwrite/fix-cache-delete-bug-dbpm

fix delete cache file to dbp-master
This commit is contained in:
Christy Jacob 2023-06-13 20:39:27 +05:30 committed by GitHub
commit ce1ad823b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 11 deletions

View file

@ -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));
@ -1258,8 +1257,7 @@ App::put('/v1/storage/buckets/:bucketId/files/:fileId')
->inject('user')
->inject('mode')
->inject('events')
->inject('deletes')
->action(function (string $bucketId, string $fileId, ?array $permissions, Response $response, Database $dbForProject, Document $user, string $mode, Event $events, Delete $deletes) {
->action(function (string $bucketId, string $fileId, ?array $permissions, Response $response, Database $dbForProject, Document $user, string $mode, Event $events) {
$bucket = Authorization::skip(fn () => $dbForProject->getDocument('buckets', $bucketId));
@ -1325,11 +1323,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())

View file

@ -168,8 +168,8 @@ class DeletesV1 extends Worker
*/
protected function deleteCacheByResource(Document $project, string $resource): void
{
$dbForProject = $this->getProjectDB($project);
$projectId = $project->getId();
$dbForProject = $this->getProjectDB($project);
$document = $dbForProject->findOne('cache', [Query::equal('resource', [$resource])]);
if ($document) {
@ -200,7 +200,6 @@ class DeletesV1 extends Worker
protected function deleteCacheByDate(string $datetime): void
{
$this->deleteForProjectIds(function (Document $project) use ($datetime) {
$projectId = $project->getId();
$dbForProject = $this->getProjectDB($project);
$cache = new Cache(