1
0
Fork 0
mirror of synced 2024-09-08 05:42:15 +12:00

cache deletion bug fix

This commit is contained in:
shimon 2023-06-13 14:33:26 +03:00
parent 13066c3dde
commit 7e95f529a6
2 changed files with 3 additions and 8 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));
@ -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())

View file

@ -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) {