feat: update date time calculation

This commit is contained in:
Christy Jacob
2022-08-19 20:22:38 +05:30
parent 7673fb44e5
commit ca25d329ae
2 changed files with 5 additions and 4 deletions
+4 -3
View File
@@ -306,8 +306,9 @@ App::init()
Authorization::setRole(Auth::USER_ROLE_APPS);
Authorization::setDefaultStatus(false); // Cancel security segmentation for API keys.
if (time() > $key->getAttribute('accessedAt', 0) + APP_KEY_ACCCESS) {
$key->setAttribute('accessedAt', time());
$accessedAt = $key->getAttribute('accessedAt', '');
if (DateTime::formatTz(DateTime::addSeconds(new \DateTime(), -APP_KEY_ACCCESS)) > $accessedAt) {
$key->setAttribute('accessedAt', DateTime::now());
$dbForConsole->updateDocument('keys', $key->getId(), $key);
$dbForConsole->deleteCachedDocument('projects', $project->getId());
}
@@ -321,7 +322,7 @@ App::init()
$key->setAttribute('sdks', $sdks);
/** Update access time as well */
$key->setAttribute('accessedAt', time());
$key->setAttribute('accessedAt', Datetime::now());
$dbForConsole->updateDocument('keys', $key->getId(), $key);
$dbForConsole->deleteCachedDocument('projects', $project->getId());
}
Generated
+1 -1
View File
@@ -5375,5 +5375,5 @@
"platform-overrides": {
"php": "8.0"
},
"plugin-api-version": "2.2.0"
"plugin-api-version": "2.3.0"
}