From f1f660352ea4e20e7c4ee7c578b2e2ee50e6d2d8 Mon Sep 17 00:00:00 2001 From: Shimon Newman Date: Wed, 29 Jan 2025 10:30:35 +0200 Subject: [PATCH] Revert "Transformed at addition" --- app/config/collections/common.php | 18 ------------------ app/controllers/api/storage.php | 7 ------- app/controllers/shared/api.php | 6 ------ app/init.php | 1 - 4 files changed, 32 deletions(-) diff --git a/app/config/collections/common.php b/app/config/collections/common.php index f68400e226..a613e8f3ab 100644 --- a/app/config/collections/common.php +++ b/app/config/collections/common.php @@ -2548,17 +2548,6 @@ return [ 'array' => false, 'filters' => [], ], - [ - '$id' => 'transformedAt', - 'type' => Database::VAR_DATETIME, - 'format' => '', - 'size' => 0, - 'signed' => false, - 'required' => false, - 'default' => null, - 'array' => false, - 'filters' => ['datetime'], - ], [ '$id' => ID::custom('search'), 'type' => Database::VAR_STRING, @@ -2628,13 +2617,6 @@ return [ 'lengths' => [], 'orders' => [Database::ORDER_ASC], ], - [ - '$id' => ID::custom('_key_transformedAt'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['transformedAt'], - 'lengths' => [], - 'orders' => [], - ] ] ], ]; diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index b5ddc94c9d..b6a07c356d 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -21,7 +21,6 @@ use Appwrite\Utopia\Response; use Utopia\App; use Utopia\Config\Config; use Utopia\Database\Database; -use Utopia\Database\DateTime; use Utopia\Database\Document; use Utopia\Database\Exception\Duplicate as DuplicateException; use Utopia\Database\Exception\NotFound as NotFoundException; @@ -1076,12 +1075,6 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/preview') ->addMetric(str_replace('{bucketInternalId}', $bucket->getInternalId(), METRIC_BUCKET_ID_FILES_TRANSFORMATIONS), 1) ; - $transformedAt = $file->getAttribute('transformedAt', ''); - if (DateTime::formatTz(DateTime::addSeconds(new \DateTime(), -APP_PROJECT_ACCESS)) > $transformedAt) { - $file->setAttribute('transformedAt', DateTime::now()); - Authorization::skip(fn () => $dbForProject->updateDocument('bucket_' . $file->getAttribute('bucketInternalId'), $file->getId(), $file)); - } - $response ->addHeader('Cache-Control', 'private, max-age=2592000') // 30 days ->setContentType($contentType) diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index 12b65fe6cd..e2845521f8 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -607,12 +607,6 @@ App::init() if ($file->isEmpty()) { throw new Exception(Exception::STORAGE_FILE_NOT_FOUND); } - - $transformedAt = $file->getAttribute('transformedAt', ''); - if (DateTime::formatTz(DateTime::addSeconds(new \DateTime(), -APP_PROJECT_ACCESS)) > $transformedAt) { - $file->setAttribute('transformedAt', DateTime::now()); - Authorization::skip(fn () => $dbForProject->updateDocument('bucket_' . $file->getAttribute('bucketInternalId'), $file->getId(), $file)); - } } $response diff --git a/app/init.php b/app/init.php index e912ffd8f4..f812ef094c 100644 --- a/app/init.php +++ b/app/init.php @@ -122,7 +122,6 @@ const APP_LIMIT_LIST_DEFAULT = 25; // Default maximum number of items to return const APP_KEY_ACCESS = 24 * 60 * 60; // 24 hours const APP_USER_ACCESS = 24 * 60 * 60; // 24 hours const APP_PROJECT_ACCESS = 24 * 60 * 60; // 24 hours -const APP_FILE_ACCESS = 24 * 60 * 60; // 24 hours const APP_CACHE_UPDATE = 24 * 60 * 60; // 24 hours const APP_CACHE_BUSTER = 4318; const APP_VERSION_STABLE = '1.6.1';