Update method names
This commit is contained in:
parent
35163ff52a
commit
7b8e37b03d
18 changed files with 145 additions and 139 deletions
|
@ -248,7 +248,7 @@ App::post('/v1/account/sessions/email')
|
|||
$dbForProject->updateDocument('users', $user->getId(), $user);
|
||||
}
|
||||
|
||||
$dbForProject->deleteCachedDocument('users', $user->getId());
|
||||
$dbForProject->purgeCachedDocument('users', $user->getId());
|
||||
|
||||
$session = $dbForProject->createDocument('sessions', $session->setAttribute('$permissions', [
|
||||
Permission::read(Role::user($user->getId())),
|
||||
|
@ -567,7 +567,7 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect')
|
|||
$currentDocument = $dbForProject->getDocument('sessions', $current);
|
||||
if (!$currentDocument->isEmpty()) {
|
||||
$dbForProject->deleteDocument('sessions', $currentDocument->getId());
|
||||
$dbForProject->deleteCachedDocument('users', $user->getId());
|
||||
$dbForProject->purgeCachedDocument('users', $user->getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -755,7 +755,7 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect')
|
|||
Permission::delete(Role::user($user->getId())),
|
||||
]));
|
||||
|
||||
$dbForProject->deleteCachedDocument('users', $user->getId());
|
||||
$dbForProject->purgeCachedDocument('users', $user->getId());
|
||||
|
||||
$session->setAttribute('expire', $expire);
|
||||
|
||||
|
@ -985,7 +985,7 @@ App::post('/v1/account/sessions/magic-url')
|
|||
Permission::delete(Role::user($user->getId())),
|
||||
]));
|
||||
|
||||
$dbForProject->deleteCachedDocument('users', $user->getId());
|
||||
$dbForProject->purgeCachedDocument('users', $user->getId());
|
||||
|
||||
if (empty($url)) {
|
||||
$url = $request->getProtocol() . '://' . $request->getHostname() . '/auth/magic-url';
|
||||
|
@ -1164,7 +1164,7 @@ App::put('/v1/account/sessions/magic-url')
|
|||
Permission::delete(Role::user($user->getId())),
|
||||
]));
|
||||
|
||||
$dbForProject->deleteCachedDocument('users', $user->getId());
|
||||
$dbForProject->purgeCachedDocument('users', $user->getId());
|
||||
|
||||
$tokens = $user->getAttribute('tokens', []);
|
||||
|
||||
|
@ -1173,7 +1173,7 @@ App::put('/v1/account/sessions/magic-url')
|
|||
* the recovery token but actually we don't need it anymore.
|
||||
*/
|
||||
$dbForProject->deleteDocument('tokens', $token);
|
||||
$dbForProject->deleteCachedDocument('users', $user->getId());
|
||||
$dbForProject->purgeCachedDocument('users', $user->getId());
|
||||
|
||||
$user->setAttribute('emailVerification', true);
|
||||
|
||||
|
@ -1311,7 +1311,7 @@ App::post('/v1/account/sessions/phone')
|
|||
Permission::delete(Role::user($user->getId())),
|
||||
]));
|
||||
|
||||
$dbForProject->deleteCachedDocument('users', $user->getId());
|
||||
$dbForProject->purgeCachedDocument('users', $user->getId());
|
||||
|
||||
$message = Template::fromFile(__DIR__ . '/../../config/locale/templates/sms-base.tpl');
|
||||
|
||||
|
@ -1415,14 +1415,14 @@ App::put('/v1/account/sessions/phone')
|
|||
Permission::delete(Role::user($user->getId())),
|
||||
]));
|
||||
|
||||
$dbForProject->deleteCachedDocument('users', $user->getId());
|
||||
$dbForProject->purgeCachedDocument('users', $user->getId());
|
||||
|
||||
/**
|
||||
* We act like we're updating and validating
|
||||
* the recovery token but actually we don't need it anymore.
|
||||
*/
|
||||
$dbForProject->deleteDocument('tokens', $token);
|
||||
$dbForProject->deleteCachedDocument('users', $user->getId());
|
||||
$dbForProject->purgeCachedDocument('users', $user->getId());
|
||||
|
||||
$user->setAttribute('phoneVerification', true);
|
||||
|
||||
|
@ -1569,7 +1569,7 @@ App::post('/v1/account/sessions/anonymous')
|
|||
Permission::delete(Role::user($user->getId())),
|
||||
]));
|
||||
|
||||
$dbForProject->deleteCachedDocument('users', $user->getId());
|
||||
$dbForProject->purgeCachedDocument('users', $user->getId());
|
||||
|
||||
$queueForEvents
|
||||
->setParam('userId', $user->getId())
|
||||
|
@ -2203,7 +2203,7 @@ App::delete('/v1/account/sessions/:sessionId')
|
|||
;
|
||||
}
|
||||
|
||||
$dbForProject->deleteCachedDocument('users', $user->getId());
|
||||
$dbForProject->purgeCachedDocument('users', $user->getId());
|
||||
|
||||
$queueForEvents
|
||||
->setParam('userId', $user->getId())
|
||||
|
@ -2284,7 +2284,7 @@ App::patch('/v1/account/sessions/:sessionId')
|
|||
|
||||
$dbForProject->updateDocument('sessions', $sessionId, $session);
|
||||
|
||||
$dbForProject->deleteCachedDocument('users', $user->getId());
|
||||
$dbForProject->purgeCachedDocument('users', $user->getId());
|
||||
|
||||
$authDuration = $project->getAttribute('auths', [])['duration'] ?? Auth::TOKEN_EXPIRATION_LOGIN_LONG;
|
||||
|
||||
|
@ -2355,7 +2355,7 @@ App::delete('/v1/account/sessions')
|
|||
}
|
||||
}
|
||||
|
||||
$dbForProject->deleteCachedDocument('users', $user->getId());
|
||||
$dbForProject->purgeCachedDocument('users', $user->getId());
|
||||
|
||||
$queueForEvents
|
||||
->setParam('userId', $user->getId())
|
||||
|
@ -2441,7 +2441,7 @@ App::post('/v1/account/recovery')
|
|||
Permission::delete(Role::user($profile->getId())),
|
||||
]));
|
||||
|
||||
$dbForProject->deleteCachedDocument('users', $profile->getId());
|
||||
$dbForProject->purgeCachedDocument('users', $profile->getId());
|
||||
|
||||
$url = Template::parseURL($url);
|
||||
$url['query'] = Template::mergeQuery(((isset($url['query'])) ? $url['query'] : ''), ['userId' => $profile->getId(), 'secret' => $secret, 'expire' => $expire]);
|
||||
|
@ -2620,7 +2620,7 @@ App::put('/v1/account/recovery')
|
|||
* the recovery token but actually we don't need it anymore.
|
||||
*/
|
||||
$dbForProject->deleteDocument('tokens', $recovery);
|
||||
$dbForProject->deleteCachedDocument('users', $profile->getId());
|
||||
$dbForProject->purgeCachedDocument('users', $profile->getId());
|
||||
|
||||
$queueForEvents
|
||||
->setParam('userId', $profile->getId())
|
||||
|
@ -2692,7 +2692,7 @@ App::post('/v1/account/verification')
|
|||
Permission::delete(Role::user($user->getId())),
|
||||
]));
|
||||
|
||||
$dbForProject->deleteCachedDocument('users', $user->getId());
|
||||
$dbForProject->purgeCachedDocument('users', $user->getId());
|
||||
|
||||
$url = Template::parseURL($url);
|
||||
$url['query'] = Template::mergeQuery(((isset($url['query'])) ? $url['query'] : ''), ['userId' => $user->getId(), 'secret' => $verificationSecret, 'expire' => $expire]);
|
||||
|
@ -2842,7 +2842,7 @@ App::put('/v1/account/verification')
|
|||
* the verification token but actually we don't need it anymore.
|
||||
*/
|
||||
$dbForProject->deleteDocument('tokens', $verification);
|
||||
$dbForProject->deleteCachedDocument('users', $profile->getId());
|
||||
$dbForProject->purgeCachedDocument('users', $profile->getId());
|
||||
|
||||
$queueForEvents
|
||||
->setParam('userId', $userId)
|
||||
|
@ -2917,7 +2917,7 @@ App::post('/v1/account/verification/phone')
|
|||
Permission::delete(Role::user($user->getId())),
|
||||
]));
|
||||
|
||||
$dbForProject->deleteCachedDocument('users', $user->getId());
|
||||
$dbForProject->purgeCachedDocument('users', $user->getId());
|
||||
|
||||
$message = Template::fromFile(__DIR__ . '/../../config/locale/templates/sms-base.tpl');
|
||||
|
||||
|
@ -3001,7 +3001,7 @@ App::put('/v1/account/verification/phone')
|
|||
* We act like we're updating and validating the verification token but actually we don't need it anymore.
|
||||
*/
|
||||
$dbForProject->deleteDocument('tokens', $verification);
|
||||
$dbForProject->deleteCachedDocument('users', $profile->getId());
|
||||
$dbForProject->purgeCachedDocument('users', $profile->getId());
|
||||
|
||||
$queueForEvents
|
||||
->setParam('userId', $user->getId())
|
||||
|
|
|
@ -116,7 +116,7 @@ $getUserGitHub = function (string $userId, Document $project, Database $dbForPro
|
|||
|
||||
Authorization::skip(fn () => $dbForProject->updateDocument('sessions', $gitHubSession->getId(), $gitHubSession));
|
||||
|
||||
$dbForProject->deleteCachedDocument('users', $user->getId());
|
||||
$dbForProject->purgeCachedDocument('users', $user->getId());
|
||||
} catch (Throwable $err) {
|
||||
$index = 0;
|
||||
do {
|
||||
|
|
|
@ -153,13 +153,13 @@ function createAttribute(string $databaseId, string $collectionId, Document $att
|
|||
} catch (LimitException) {
|
||||
throw new Exception(Exception::ATTRIBUTE_LIMIT_EXCEEDED, 'Attribute limit exceeded');
|
||||
} catch (\Exception $e) {
|
||||
$dbForProject->deleteCachedDocument('database_' . $db->getInternalId(), $collectionId);
|
||||
$dbForProject->deleteCachedCollection('database_' . $db->getInternalId() . '_collection_' . $collection->getInternalId());
|
||||
$dbForProject->purgeCachedDocument('database_' . $db->getInternalId(), $collectionId);
|
||||
$dbForProject->purgeCachedCollection('database_' . $db->getInternalId() . '_collection_' . $collection->getInternalId());
|
||||
throw $e;
|
||||
}
|
||||
|
||||
$dbForProject->deleteCachedDocument('database_' . $db->getInternalId(), $collectionId);
|
||||
$dbForProject->deleteCachedCollection('database_' . $db->getInternalId() . '_collection_' . $collection->getInternalId());
|
||||
$dbForProject->purgeCachedDocument('database_' . $db->getInternalId(), $collectionId);
|
||||
$dbForProject->purgeCachedCollection('database_' . $db->getInternalId() . '_collection_' . $collection->getInternalId());
|
||||
|
||||
if ($type === Database::VAR_RELATIONSHIP && $options['twoWay']) {
|
||||
$twoWayKey = $options['twoWayKey'];
|
||||
|
@ -197,13 +197,13 @@ function createAttribute(string $databaseId, string $collectionId, Document $att
|
|||
$dbForProject->deleteDocument('attributes', $attribute->getId());
|
||||
throw new Exception(Exception::ATTRIBUTE_LIMIT_EXCEEDED, 'Attribute limit exceeded');
|
||||
} catch (\Exception $e) {
|
||||
$dbForProject->deleteCachedDocument('database_' . $db->getInternalId(), $relatedCollection->getId());
|
||||
$dbForProject->deleteCachedCollection('database_' . $db->getInternalId() . '_collection_' . $relatedCollection->getInternalId());
|
||||
$dbForProject->purgeCachedDocument('database_' . $db->getInternalId(), $relatedCollection->getId());
|
||||
$dbForProject->purgeCachedCollection('database_' . $db->getInternalId() . '_collection_' . $relatedCollection->getInternalId());
|
||||
throw $e;
|
||||
}
|
||||
|
||||
$dbForProject->deleteCachedDocument('database_' . $db->getInternalId(), $relatedCollection->getId());
|
||||
$dbForProject->deleteCachedCollection('database_' . $db->getInternalId() . '_collection_' . $relatedCollection->getInternalId());
|
||||
$dbForProject->purgeCachedDocument('database_' . $db->getInternalId(), $relatedCollection->getId());
|
||||
$dbForProject->purgeCachedCollection('database_' . $db->getInternalId() . '_collection_' . $relatedCollection->getInternalId());
|
||||
}
|
||||
|
||||
$queueForDatabase
|
||||
|
@ -358,7 +358,7 @@ function updateAttribute(
|
|||
$relatedOptions = \array_merge($relatedAttribute->getAttribute('options'), $options);
|
||||
$relatedAttribute->setAttribute('options', $relatedOptions);
|
||||
$dbForProject->updateDocument('attributes', $db->getInternalId() . '_' . $relatedCollection->getInternalId() . '_' . $primaryDocumentOptions['twoWayKey'], $relatedAttribute);
|
||||
$dbForProject->deleteCachedDocument('database_' . $db->getInternalId(), $relatedCollection->getId());
|
||||
$dbForProject->purgeCachedDocument('database_' . $db->getInternalId(), $relatedCollection->getId());
|
||||
}
|
||||
} else {
|
||||
$dbForProject->updateAttribute(
|
||||
|
@ -371,7 +371,7 @@ function updateAttribute(
|
|||
}
|
||||
|
||||
$attribute = $dbForProject->updateDocument('attributes', $db->getInternalId() . '_' . $collection->getInternalId() . '_' . $key, $attribute);
|
||||
$dbForProject->deleteCachedDocument('database_' . $db->getInternalId(), $collection->getId());
|
||||
$dbForProject->purgeCachedDocument('database_' . $db->getInternalId(), $collection->getId());
|
||||
|
||||
$queueForEvents
|
||||
->setContext('collection', $collection)
|
||||
|
@ -708,8 +708,8 @@ App::delete('/v1/databases/:databaseId')
|
|||
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove collection from DB');
|
||||
}
|
||||
|
||||
$dbForProject->deleteCachedDocument('databases', $database->getId());
|
||||
$dbForProject->deleteCachedCollection('databases_' . $database->getInternalId());
|
||||
$dbForProject->purgeCachedDocument('databases', $database->getId());
|
||||
$dbForProject->purgeCachedCollection('databases_' . $database->getInternalId());
|
||||
|
||||
$queueForDatabase
|
||||
->setType(DATABASE_TYPE_DELETE_DATABASE)
|
||||
|
@ -1093,7 +1093,7 @@ App::delete('/v1/databases/:databaseId/collections/:collectionId')
|
|||
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove collection from DB');
|
||||
}
|
||||
|
||||
$dbForProject->deleteCachedCollection('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId());
|
||||
$dbForProject->purgeCachedCollection('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId());
|
||||
|
||||
$queueForDatabase
|
||||
->setType(DATABASE_TYPE_DELETE_COLLECTION)
|
||||
|
@ -2321,8 +2321,8 @@ App::delete('/v1/databases/:databaseId/collections/:collectionId/attributes/:key
|
|||
$attribute = $dbForProject->updateDocument('attributes', $attribute->getId(), $attribute->setAttribute('status', 'deleting'));
|
||||
}
|
||||
|
||||
$dbForProject->deleteCachedDocument('database_' . $db->getInternalId(), $collectionId);
|
||||
$dbForProject->deleteCachedCollection('database_' . $db->getInternalId() . '_collection_' . $collection->getInternalId());
|
||||
$dbForProject->purgeCachedDocument('database_' . $db->getInternalId(), $collectionId);
|
||||
$dbForProject->purgeCachedCollection('database_' . $db->getInternalId() . '_collection_' . $collection->getInternalId());
|
||||
|
||||
if ($attribute->getAttribute('type') === Database::VAR_RELATIONSHIP) {
|
||||
$options = $attribute->getAttribute('options');
|
||||
|
@ -2343,8 +2343,8 @@ App::delete('/v1/databases/:databaseId/collections/:collectionId/attributes/:key
|
|||
$dbForProject->updateDocument('attributes', $relatedAttribute->getId(), $relatedAttribute->setAttribute('status', 'deleting'));
|
||||
}
|
||||
|
||||
$dbForProject->deleteCachedDocument('database_' . $db->getInternalId(), $options['relatedCollection']);
|
||||
$dbForProject->deleteCachedCollection('database_' . $db->getInternalId() . '_collection_' . $relatedCollection->getInternalId());
|
||||
$dbForProject->purgeCachedDocument('database_' . $db->getInternalId(), $options['relatedCollection']);
|
||||
$dbForProject->purgeCachedCollection('database_' . $db->getInternalId() . '_collection_' . $relatedCollection->getInternalId());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2528,7 +2528,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/indexes')
|
|||
throw new Exception(Exception::INDEX_ALREADY_EXISTS);
|
||||
}
|
||||
|
||||
$dbForProject->deleteCachedDocument('database_' . $db->getInternalId(), $collectionId);
|
||||
$dbForProject->purgeCachedDocument('database_' . $db->getInternalId(), $collectionId);
|
||||
|
||||
$queueForDatabase
|
||||
->setType(DATABASE_TYPE_CREATE_INDEX)
|
||||
|
@ -2701,7 +2701,7 @@ App::delete('/v1/databases/:databaseId/collections/:collectionId/indexes/:key')
|
|||
$index = $dbForProject->updateDocument('indexes', $index->getId(), $index->setAttribute('status', 'deleting'));
|
||||
}
|
||||
|
||||
$dbForProject->deleteCachedDocument('database_' . $db->getInternalId(), $collectionId);
|
||||
$dbForProject->purgeCachedDocument('database_' . $db->getInternalId(), $collectionId);
|
||||
|
||||
$queueForDatabase
|
||||
->setType(DATABASE_TYPE_DELETE_INDEX)
|
||||
|
|
|
@ -941,7 +941,7 @@ App::post('/v1/projects/:projectId/webhooks')
|
|||
|
||||
$webhook = $dbForConsole->createDocument('webhooks', $webhook);
|
||||
|
||||
$dbForConsole->deleteCachedDocument('projects', $project->getId());
|
||||
$dbForConsole->purgeCachedDocument('projects', $project->getId());
|
||||
|
||||
$response
|
||||
->setStatusCode(Response::STATUS_CODE_CREATED)
|
||||
|
@ -1062,7 +1062,7 @@ App::put('/v1/projects/:projectId/webhooks/:webhookId')
|
|||
->setAttribute('httpPass', $httpPass);
|
||||
|
||||
$dbForConsole->updateDocument('webhooks', $webhook->getId(), $webhook);
|
||||
$dbForConsole->deleteCachedDocument('projects', $project->getId());
|
||||
$dbForConsole->purgeCachedDocument('projects', $project->getId());
|
||||
|
||||
$response->dynamic($webhook, Response::MODEL_WEBHOOK);
|
||||
});
|
||||
|
@ -1101,7 +1101,7 @@ App::patch('/v1/projects/:projectId/webhooks/:webhookId/signature')
|
|||
$webhook->setAttribute('signatureKey', \bin2hex(\random_bytes(64)));
|
||||
|
||||
$dbForConsole->updateDocument('webhooks', $webhook->getId(), $webhook);
|
||||
$dbForConsole->deleteCachedDocument('projects', $project->getId());
|
||||
$dbForConsole->purgeCachedDocument('projects', $project->getId());
|
||||
|
||||
$response->dynamic($webhook, Response::MODEL_WEBHOOK);
|
||||
});
|
||||
|
@ -1138,7 +1138,7 @@ App::delete('/v1/projects/:projectId/webhooks/:webhookId')
|
|||
|
||||
$dbForConsole->deleteDocument('webhooks', $webhook->getId());
|
||||
|
||||
$dbForConsole->deleteCachedDocument('projects', $project->getId());
|
||||
$dbForConsole->purgeCachedDocument('projects', $project->getId());
|
||||
|
||||
$response->noContent();
|
||||
});
|
||||
|
@ -1188,7 +1188,7 @@ App::post('/v1/projects/:projectId/keys')
|
|||
|
||||
$key = $dbForConsole->createDocument('keys', $key);
|
||||
|
||||
$dbForConsole->deleteCachedDocument('projects', $project->getId());
|
||||
$dbForConsole->purgeCachedDocument('projects', $project->getId());
|
||||
|
||||
$response
|
||||
->setStatusCode(Response::STATUS_CODE_CREATED)
|
||||
|
@ -1302,7 +1302,7 @@ App::put('/v1/projects/:projectId/keys/:keyId')
|
|||
|
||||
$dbForConsole->updateDocument('keys', $key->getId(), $key);
|
||||
|
||||
$dbForConsole->deleteCachedDocument('projects', $project->getId());
|
||||
$dbForConsole->purgeCachedDocument('projects', $project->getId());
|
||||
|
||||
$response->dynamic($key, Response::MODEL_KEY);
|
||||
});
|
||||
|
@ -1339,7 +1339,7 @@ App::delete('/v1/projects/:projectId/keys/:keyId')
|
|||
|
||||
$dbForConsole->deleteDocument('keys', $key->getId());
|
||||
|
||||
$dbForConsole->deleteCachedDocument('projects', $project->getId());
|
||||
$dbForConsole->purgeCachedDocument('projects', $project->getId());
|
||||
|
||||
$response->noContent();
|
||||
});
|
||||
|
@ -1389,7 +1389,7 @@ App::post('/v1/projects/:projectId/platforms')
|
|||
|
||||
$platform = $dbForConsole->createDocument('platforms', $platform);
|
||||
|
||||
$dbForConsole->deleteCachedDocument('projects', $project->getId());
|
||||
$dbForConsole->purgeCachedDocument('projects', $project->getId());
|
||||
|
||||
$response
|
||||
->setStatusCode(Response::STATUS_CODE_CREATED)
|
||||
|
@ -1504,7 +1504,7 @@ App::put('/v1/projects/:projectId/platforms/:platformId')
|
|||
|
||||
$dbForConsole->updateDocument('platforms', $platform->getId(), $platform);
|
||||
|
||||
$dbForConsole->deleteCachedDocument('projects', $project->getId());
|
||||
$dbForConsole->purgeCachedDocument('projects', $project->getId());
|
||||
|
||||
$response->dynamic($platform, Response::MODEL_PLATFORM);
|
||||
});
|
||||
|
@ -1541,7 +1541,7 @@ App::delete('/v1/projects/:projectId/platforms/:platformId')
|
|||
|
||||
$dbForConsole->deleteDocument('platforms', $platformId);
|
||||
|
||||
$dbForConsole->deleteCachedDocument('projects', $project->getId());
|
||||
$dbForConsole->purgeCachedDocument('projects', $project->getId());
|
||||
|
||||
$response->noContent();
|
||||
});
|
||||
|
|
|
@ -114,7 +114,7 @@ App::post('/v1/teams')
|
|||
]);
|
||||
|
||||
$membership = $dbForProject->createDocument('memberships', $membership);
|
||||
$dbForProject->deleteCachedDocument('users', $user->getId());
|
||||
$dbForProject->purgeCachedDocument('users', $user->getId());
|
||||
}
|
||||
|
||||
$queueForEvents->setParam('teamId', $team->getId());
|
||||
|
@ -536,7 +536,7 @@ App::post('/v1/teams/:teamId/memberships')
|
|||
$team->setAttribute('total', $team->getAttribute('total', 0) + 1);
|
||||
$team = Authorization::skip(fn() => $dbForProject->updateDocument('teams', $team->getId(), $team));
|
||||
|
||||
$dbForProject->deleteCachedDocument('users', $invitee->getId());
|
||||
$dbForProject->purgeCachedDocument('users', $invitee->getId());
|
||||
} else {
|
||||
try {
|
||||
$membership = $dbForProject->createDocument('memberships', $membership);
|
||||
|
@ -843,7 +843,7 @@ App::patch('/v1/teams/:teamId/memberships/:membershipId')
|
|||
/**
|
||||
* Replace membership on profile
|
||||
*/
|
||||
$dbForProject->deleteCachedDocument('users', $profile->getId());
|
||||
$dbForProject->purgeCachedDocument('users', $profile->getId());
|
||||
|
||||
$queueForEvents
|
||||
->setParam('teamId', $team->getId())
|
||||
|
@ -958,13 +958,13 @@ App::patch('/v1/teams/:teamId/memberships/:membershipId/status')
|
|||
Permission::delete(Role::user($user->getId())),
|
||||
]));
|
||||
|
||||
$dbForProject->deleteCachedDocument('users', $user->getId());
|
||||
$dbForProject->purgeCachedDocument('users', $user->getId());
|
||||
|
||||
Authorization::setRole(Role::user($userId)->toString());
|
||||
|
||||
$membership = $dbForProject->updateDocument('memberships', $membership->getId(), $membership);
|
||||
|
||||
$dbForProject->deleteCachedDocument('users', $user->getId());
|
||||
$dbForProject->purgeCachedDocument('users', $user->getId());
|
||||
|
||||
$team = Authorization::skip(fn() => $dbForProject->updateDocument('teams', $team->getId(), $team->setAttribute('total', $team->getAttribute('total', 0) + 1)));
|
||||
|
||||
|
@ -1043,7 +1043,7 @@ App::delete('/v1/teams/:teamId/memberships/:membershipId')
|
|||
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove membership from DB');
|
||||
}
|
||||
|
||||
$dbForProject->deleteCachedDocument('users', $user->getId());
|
||||
$dbForProject->purgeCachedDocument('users', $user->getId());
|
||||
|
||||
if ($membership->getAttribute('confirm')) { // Count only confirmed members
|
||||
$team->setAttribute('total', \max($team->getAttribute('total', 0) - 1, 0));
|
||||
|
|
|
@ -1114,7 +1114,7 @@ App::delete('/v1/users/:userId/sessions/:sessionId')
|
|||
}
|
||||
|
||||
$dbForProject->deleteDocument('sessions', $session->getId());
|
||||
$dbForProject->deleteCachedDocument('users', $user->getId());
|
||||
$dbForProject->purgeCachedDocument('users', $user->getId());
|
||||
|
||||
$queueForEvents
|
||||
->setParam('userId', $user->getId())
|
||||
|
@ -1158,7 +1158,7 @@ App::delete('/v1/users/:userId/sessions')
|
|||
//TODO: fix this
|
||||
}
|
||||
|
||||
$dbForProject->deleteCachedDocument('users', $user->getId());
|
||||
$dbForProject->purgeCachedDocument('users', $user->getId());
|
||||
|
||||
$queueForEvents
|
||||
->setParam('userId', $user->getId())
|
||||
|
|
|
@ -232,7 +232,9 @@ App::init()
|
|||
Request::setRoute($route);
|
||||
|
||||
if ($route === null) {
|
||||
return $response->setStatusCode(404)->send('Not Found');
|
||||
return $response
|
||||
->setStatusCode(404)
|
||||
->send('Not Found');
|
||||
}
|
||||
|
||||
$requestFormat = $request->getHeader('x-appwrite-response-format', App::getEnv('_APP_SYSTEM_RESPONSE_FORMAT', ''));
|
||||
|
@ -511,7 +513,7 @@ App::init()
|
|||
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());
|
||||
$dbForConsole->purgeCachedDocument('projects', $project->getId());
|
||||
}
|
||||
|
||||
$sdkValidator = new WhiteList($servers, true);
|
||||
|
@ -525,7 +527,7 @@ App::init()
|
|||
/** Update access time as well */
|
||||
$key->setAttribute('accessedAt', Datetime::now());
|
||||
$dbForConsole->updateDocument('keys', $key->getId(), $key);
|
||||
$dbForConsole->deleteCachedDocument('projects', $project->getId());
|
||||
$dbForConsole->purgeCachedDocument('projects', $project->getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -678,6 +680,7 @@ App::error()
|
|||
Console::error('[Error] Message: ' . $message);
|
||||
Console::error('[Error] File: ' . $file);
|
||||
Console::error('[Error] Line: ' . $line);
|
||||
Console::error('[Error] Trace: ' . $error->getTraceAsString());
|
||||
}
|
||||
|
||||
/** Handle Utopia Errors */
|
||||
|
|
|
@ -350,7 +350,7 @@ App::shutdown()
|
|||
$session = array_shift($sessions);
|
||||
$dbForProject->deleteDocument('sessions', $session->getId());
|
||||
}
|
||||
$dbForProject->deleteCachedDocument('users', $userId);
|
||||
$dbForProject->purgeCachedDocument('users', $userId);
|
||||
});
|
||||
|
||||
App::shutdown()
|
||||
|
|
29
app/init.php
29
app/init.php
|
@ -935,22 +935,25 @@ App::setResource('clients', function ($request, $console, $project) {
|
|||
fn ($node) => $node['hostname'],
|
||||
\array_filter(
|
||||
$console->getAttribute('platforms', []),
|
||||
fn ($node) => (isset($node['type']) && ($node['type'] === Origin::CLIENT_TYPE_WEB) && isset($node['hostname']) && !empty($node['hostname']))
|
||||
fn ($node) => (isset($node['type']) && ($node['type'] === Origin::CLIENT_TYPE_WEB) && !empty($node['hostname']))
|
||||
)
|
||||
);
|
||||
|
||||
$clients = \array_unique(
|
||||
\array_merge(
|
||||
$clientsConsole,
|
||||
\array_map(
|
||||
fn ($node) => $node['hostname'],
|
||||
\array_filter(
|
||||
$project->getAttribute('platforms', []),
|
||||
fn ($node) => (isset($node['type']) && ($node['type'] === Origin::CLIENT_TYPE_WEB || $node['type'] === Origin::CLIENT_TYPE_FLUTTER_WEB) && isset($node['hostname']) && !empty($node['hostname']))
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
$clients = $clientsConsole;
|
||||
$platforms = $project->getAttribute('platforms', []);
|
||||
|
||||
foreach ($platforms as $node) {
|
||||
if (
|
||||
isset($node['type']) &&
|
||||
($node['type'] === Origin::CLIENT_TYPE_WEB ||
|
||||
$node['type'] === Origin::CLIENT_TYPE_FLUTTER_WEB) &&
|
||||
!empty($node['hostname'])
|
||||
) {
|
||||
$clients[] = $node['hostname'];
|
||||
}
|
||||
}
|
||||
|
||||
$clients = array_unique($clients);
|
||||
|
||||
return $clients;
|
||||
}, ['request', 'console', 'project']);
|
||||
|
|
8
composer.lock
generated
8
composer.lock
generated
|
@ -1910,12 +1910,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/utopia-php/database.git",
|
||||
"reference": "b7bcc9b373242a9e494b0b7bbf78dfa54333727c"
|
||||
"reference": "22f9009b06b9d9aa32ca71c76500eaa8fa3366b4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/utopia-php/database/zipball/b7bcc9b373242a9e494b0b7bbf78dfa54333727c",
|
||||
"reference": "b7bcc9b373242a9e494b0b7bbf78dfa54333727c",
|
||||
"url": "https://api.github.com/repos/utopia-php/database/zipball/22f9009b06b9d9aa32ca71c76500eaa8fa3366b4",
|
||||
"reference": "22f9009b06b9d9aa32ca71c76500eaa8fa3366b4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1958,7 +1958,7 @@
|
|||
"issues": "https://github.com/utopia-php/database/issues",
|
||||
"source": "https://github.com/utopia-php/database/tree/feat-isolation-mode"
|
||||
},
|
||||
"time": "2023-11-22T07:58:21+00:00"
|
||||
"time": "2023-11-27T01:55:11+00:00"
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/domains",
|
||||
|
|
|
@ -372,7 +372,7 @@ class V15 extends Migration
|
|||
}
|
||||
}
|
||||
|
||||
$this->projectDB->deleteCachedCollection($table);
|
||||
$this->projectDB->purgeCachedCollection($table);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -479,7 +479,7 @@ class V15 extends Migration
|
|||
$this->createCollection('cache');
|
||||
Console::log('Created new Collection "variables" collection');
|
||||
$this->createCollection('variables');
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
break;
|
||||
|
||||
case 'abuse':
|
||||
|
|
|
@ -48,7 +48,7 @@ class V17 extends Migration
|
|||
|
||||
try {
|
||||
$this->projectDB->updateAttribute($id, 'mimeType', Database::VAR_STRING, 255, true, false);
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
} catch (\Throwable $th) {
|
||||
Console::warning("'mimeType' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ class V17 extends Migration
|
|||
* Create 'size' attribute
|
||||
*/
|
||||
$this->createAttributeFromCollection($this->projectDB, $id, 'size');
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
} catch (\Throwable $th) {
|
||||
Console::warning("'size' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ class V17 extends Migration
|
|||
* Update 'mimeType' attribute size (127->255)
|
||||
*/
|
||||
$this->projectDB->updateAttribute($id, 'mimeType', Database::VAR_STRING, 255, true, false);
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
} catch (\Throwable $th) {
|
||||
Console::warning("'mimeType' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ class V17 extends Migration
|
|||
* Create 'bucketInternalId' attribute
|
||||
*/
|
||||
$this->createAttributeFromCollection($this->projectDB, $id, 'bucketInternalId');
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
} catch (\Throwable $th) {
|
||||
Console::warning("'deploymentInternalId' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ class V17 extends Migration
|
|||
* Delete 'endTime' attribute (use startTime+duration if needed)
|
||||
*/
|
||||
$this->projectDB->deleteAttribute($id, 'endTime');
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
} catch (\Throwable $th) {
|
||||
Console::warning("'endTime' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ class V17 extends Migration
|
|||
* Rename 'outputPath' to 'path'
|
||||
*/
|
||||
$this->projectDB->renameAttribute($id, 'outputPath', 'path');
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
} catch (\Throwable $th) {
|
||||
Console::warning("'path' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ class V17 extends Migration
|
|||
* Create 'deploymentInternalId' attribute
|
||||
*/
|
||||
$this->createAttributeFromCollection($this->projectDB, $id, 'deploymentInternalId');
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
} catch (\Throwable $th) {
|
||||
Console::warning("'deploymentInternalId' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ class V17 extends Migration
|
|||
* Delete 'type' attribute
|
||||
*/
|
||||
$this->projectDB->deleteAttribute($id, 'type');
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
} catch (\Throwable $th) {
|
||||
Console::warning("'type' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ class V17 extends Migration
|
|||
* Create 'resourceInternalId' attribute
|
||||
*/
|
||||
$this->createAttributeFromCollection($this->projectDB, $id, 'resourceInternalId');
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
} catch (\Throwable $th) {
|
||||
Console::warning("'resourceInternalId' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ class V17 extends Migration
|
|||
* Create 'deploymentInternalId' attribute
|
||||
*/
|
||||
$this->createAttributeFromCollection($this->projectDB, $id, 'deploymentInternalId');
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
} catch (\Throwable $th) {
|
||||
Console::warning("'deploymentInternalId' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ class V17 extends Migration
|
|||
* Create 'scheduleInternalId' attribute
|
||||
*/
|
||||
$this->createAttributeFromCollection($this->projectDB, $id, 'scheduleInternalId');
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
} catch (\Throwable $th) {
|
||||
Console::warning("'scheduleInternalId' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ class V17 extends Migration
|
|||
* Delete 'scheduleUpdatedAt' attribute
|
||||
*/
|
||||
$this->projectDB->deleteAttribute($id, 'scheduleUpdatedAt');
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
} catch (\Throwable $th) {
|
||||
Console::warning("'scheduleUpdatedAt' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ class V17 extends Migration
|
|||
* Create 'resourceInternalId' attribute
|
||||
*/
|
||||
$this->createAttributeFromCollection($this->projectDB, $id, 'resourceInternalId');
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
} catch (\Throwable $th) {
|
||||
Console::warning("'resourceInternalId' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ class V17 extends Migration
|
|||
* Create 'buildInternalId' attribute
|
||||
*/
|
||||
$this->createAttributeFromCollection($this->projectDB, $id, 'buildInternalId');
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
} catch (\Throwable $th) {
|
||||
Console::warning("'buildInternalId' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ class V17 extends Migration
|
|||
* Create 'functionInternalId' attribute
|
||||
*/
|
||||
$this->createAttributeFromCollection($this->projectDB, $id, 'functionInternalId');
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
} catch (\Throwable $th) {
|
||||
Console::warning("'functionInternalId' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ class V17 extends Migration
|
|||
* Create 'deploymentInternalId' attribute
|
||||
*/
|
||||
$this->createAttributeFromCollection($this->projectDB, $id, 'deploymentInternalId');
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
} catch (\Throwable $th) {
|
||||
Console::warning("'deploymentInternalId' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ class V18 extends Migration
|
|||
* Create 'passwordHistory' attribute
|
||||
*/
|
||||
$this->createAttributeFromCollection($this->projectDB, $id, 'passwordHistory');
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
} catch (\Throwable $th) {
|
||||
Console::warning("'passwordHistory' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ class V18 extends Migration
|
|||
* Create 'prefs' attribute
|
||||
*/
|
||||
$this->createAttributeFromCollection($this->projectDB, $id, 'prefs');
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
} catch (\Throwable $th) {
|
||||
Console::warning("'prefs' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ class V18 extends Migration
|
|||
* Create 'options' attribute
|
||||
*/
|
||||
$this->createAttributeFromCollection($this->projectDB, $id, 'options');
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
} catch (\Throwable $th) {
|
||||
Console::warning("'options' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ class V19 extends Migration
|
|||
|
||||
try {
|
||||
$this->createAttributeFromCollection($this->projectDB, $id, 'bucketInternalId', 'files');
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
} catch (\Throwable $th) {
|
||||
Console::warning("'bucketInternalId' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ class V19 extends Migration
|
|||
Console::warning("'error' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
|
||||
break;
|
||||
case 'buckets':
|
||||
|
@ -188,7 +188,7 @@ class V19 extends Migration
|
|||
}
|
||||
}
|
||||
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
|
||||
break;
|
||||
case 'builds':
|
||||
|
@ -211,7 +211,7 @@ class V19 extends Migration
|
|||
Console::warning("'path' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
|
||||
break;
|
||||
case 'certificates':
|
||||
|
@ -227,7 +227,7 @@ class V19 extends Migration
|
|||
Console::warning("'logs' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
|
||||
break;
|
||||
case 'databases':
|
||||
|
@ -237,7 +237,7 @@ class V19 extends Migration
|
|||
Console::warning("'enabled' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
|
||||
break;
|
||||
case 'deployments':
|
||||
|
@ -300,7 +300,7 @@ class V19 extends Migration
|
|||
}
|
||||
}
|
||||
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
|
||||
break;
|
||||
case 'executions':
|
||||
|
@ -361,7 +361,7 @@ class V19 extends Migration
|
|||
Console::warning("'_key_responseStatusCode' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
|
||||
break;
|
||||
case 'files':
|
||||
|
@ -388,7 +388,7 @@ class V19 extends Migration
|
|||
}
|
||||
}
|
||||
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
|
||||
break;
|
||||
case 'functions':
|
||||
|
@ -450,7 +450,7 @@ class V19 extends Migration
|
|||
}
|
||||
}
|
||||
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
|
||||
break;
|
||||
case 'memberships':
|
||||
|
@ -460,7 +460,7 @@ class V19 extends Migration
|
|||
Console::warning("'teamInternalId' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
|
||||
// Intentional fall through to update memberships.userInternalId
|
||||
case 'sessions':
|
||||
|
@ -471,7 +471,7 @@ class V19 extends Migration
|
|||
Console::warning("'userInternalId' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
|
||||
break;
|
||||
case 'domains':
|
||||
|
@ -484,7 +484,7 @@ class V19 extends Migration
|
|||
Console::warning("'projectInternalId' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
|
||||
break;
|
||||
case 'projects':
|
||||
|
@ -502,7 +502,7 @@ class V19 extends Migration
|
|||
}
|
||||
}
|
||||
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
|
||||
break;
|
||||
case 'stats':
|
||||
|
@ -515,26 +515,26 @@ class V19 extends Migration
|
|||
// Holding off on these until a future release
|
||||
// try {
|
||||
// $this->projectDB->deleteAttribute($id, 'type');
|
||||
// $this->projectDB->deleteCachedCollection($id);
|
||||
// $this->projectDB->purgeCachedCollection($id);
|
||||
// } catch (\Throwable $th) {
|
||||
// Console::warning("'type' from {$id}: {$th->getMessage()}");
|
||||
// }
|
||||
|
||||
// try {
|
||||
// $this->projectDB->deleteIndex($id, '_key_metric_period_time');
|
||||
// $this->projectDB->deleteCachedCollection($id);
|
||||
// $this->projectDB->purgeCachedCollection($id);
|
||||
// } catch (\Throwable $th) {
|
||||
// Console::warning("'_key_metric_period_time' from {$id}: {$th->getMessage()}");
|
||||
// }
|
||||
|
||||
// try {
|
||||
// $this->createIndexFromCollection($this->projectDB, $id, '_key_metric_period_time');
|
||||
// $this->projectDB->deleteCachedCollection($id);
|
||||
// $this->projectDB->purgeCachedCollection($id);
|
||||
// } catch (\Throwable $th) {
|
||||
// Console::warning("'_key_metric_period_time' from {$id}: {$th->getMessage()}");
|
||||
// }
|
||||
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
|
||||
break;
|
||||
case 'users':
|
||||
|
@ -562,7 +562,7 @@ class V19 extends Migration
|
|||
Console::warning("'_key_accessedAt' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
|
||||
break;
|
||||
case 'variables':
|
||||
|
@ -610,7 +610,7 @@ class V19 extends Migration
|
|||
}
|
||||
}
|
||||
|
||||
$this->projectDB->deleteCachedCollection($id);
|
||||
$this->projectDB->purgeCachedCollection($id);
|
||||
|
||||
break;
|
||||
default:
|
||||
|
@ -753,7 +753,7 @@ class V19 extends Migration
|
|||
Console::warning("'domains' from projects: {$th->getMessage()}");
|
||||
}
|
||||
|
||||
$this->projectDB->deleteCachedCollection('projects');
|
||||
$this->projectDB->purgeCachedCollection('projects');
|
||||
|
||||
try {
|
||||
$this->projectDB->deleteAttribute('builds', 'stderr');
|
||||
|
@ -767,7 +767,7 @@ class V19 extends Migration
|
|||
Console::warning("'stdout' from builds: {$th->getMessage()}");
|
||||
}
|
||||
|
||||
$this->projectDB->deleteCachedCollection('builds');
|
||||
$this->projectDB->purgeCachedCollection('builds');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -113,7 +113,7 @@ class DeleteOrphanedProjects extends Action
|
|||
foreach ($collections as $collection) {
|
||||
if ($commit) {
|
||||
$dbForProject->deleteCollection($collection->getId());
|
||||
$dbForConsole->deleteCachedCollection($collection->getId());
|
||||
$dbForConsole->purgeCachedCollection($collection->getId());
|
||||
}
|
||||
Console::info('--Deleting collection (' . $collection->getId() . ') project no (' . $project->getInternalId() . ')');
|
||||
}
|
||||
|
@ -121,12 +121,12 @@ class DeleteOrphanedProjects extends Action
|
|||
|
||||
if ($commit) {
|
||||
$dbForConsole->deleteDocument('projects', $project->getId());
|
||||
$dbForConsole->deleteCachedDocument('projects', $project->getId());
|
||||
$dbForConsole->purgeCachedDocument('projects', $project->getId());
|
||||
|
||||
if ($dbForProject->exists($dbForProject->getDatabase(), Database::METADATA)) {
|
||||
try {
|
||||
$dbForProject->deleteCollection(Database::METADATA);
|
||||
$dbForProject->deleteCachedCollection(Database::METADATA);
|
||||
$dbForProject->purgeCachedCollection(Database::METADATA);
|
||||
} catch (\Throwable $th) {
|
||||
Console::warning('Metadata collection does not exist');
|
||||
}
|
||||
|
|
|
@ -186,10 +186,10 @@ class Databases extends Action
|
|||
}
|
||||
|
||||
if ($type === Database::VAR_RELATIONSHIP && $options['twoWay']) {
|
||||
$dbForProject->deleteCachedDocument('database_' . $database->getInternalId(), $relatedCollection->getId());
|
||||
$dbForProject->purgeCachedDocument('database_' . $database->getInternalId(), $relatedCollection->getId());
|
||||
}
|
||||
|
||||
$dbForProject->deleteCachedDocument('database_' . $database->getInternalId(), $collectionId);
|
||||
$dbForProject->purgeCachedDocument('database_' . $database->getInternalId(), $collectionId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -336,12 +336,12 @@ class Databases extends Action
|
|||
}
|
||||
}
|
||||
|
||||
$dbForProject->deleteCachedDocument('database_' . $database->getInternalId(), $collectionId);
|
||||
$dbForProject->deleteCachedCollection('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId());
|
||||
$dbForProject->purgeCachedDocument('database_' . $database->getInternalId(), $collectionId);
|
||||
$dbForProject->purgeCachedCollection('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId());
|
||||
|
||||
if (!$relatedCollection->isEmpty() && !$relatedAttribute->isEmpty()) {
|
||||
$dbForProject->deleteCachedDocument('database_' . $database->getInternalId(), $relatedCollection->getId());
|
||||
$dbForProject->deleteCachedCollection('database_' . $database->getInternalId() . '_collection_' . $relatedCollection->getInternalId());
|
||||
$dbForProject->purgeCachedDocument('database_' . $database->getInternalId(), $relatedCollection->getId());
|
||||
$dbForProject->purgeCachedCollection('database_' . $database->getInternalId() . '_collection_' . $relatedCollection->getInternalId());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -402,7 +402,7 @@ class Databases extends Action
|
|||
$this->trigger($database, $collection, $index, $project, $projectId, $events);
|
||||
}
|
||||
|
||||
$dbForProject->deleteCachedDocument('database_' . $database->getInternalId(), $collectionId);
|
||||
$dbForProject->purgeCachedDocument('database_' . $database->getInternalId(), $collectionId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -459,7 +459,7 @@ class Databases extends Action
|
|||
$this->trigger($database, $collection, $index, $project, $projectId, $events);
|
||||
}
|
||||
|
||||
$dbForProject->deleteCachedDocument('database_' . $database->getInternalId(), $collection->getId());
|
||||
$dbForProject->purgeCachedDocument('database_' . $database->getInternalId(), $collection->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -514,8 +514,8 @@ class Databases extends Action
|
|||
}
|
||||
$relatedCollection = $dbForProject->getDocument('database_' . $databaseInternalId, $relationship['relatedCollection']);
|
||||
$dbForProject->deleteDocument('attributes', $databaseInternalId . '_' . $relatedCollection->getInternalId() . '_' . $relationship['twoWayKey']);
|
||||
$dbForProject->deleteCachedDocument('database_' . $databaseInternalId, $relatedCollection->getId());
|
||||
$dbForProject->deleteCachedCollection('database_' . $databaseInternalId . '_collection_' . $relatedCollection->getInternalId());
|
||||
$dbForProject->purgeCachedDocument('database_' . $databaseInternalId, $relatedCollection->getId());
|
||||
$dbForProject->purgeCachedCollection('database_' . $databaseInternalId . '_collection_' . $relatedCollection->getInternalId());
|
||||
}
|
||||
|
||||
$dbForProject->deleteCollection('database_' . $databaseInternalId . '_collection_' . $collection->getInternalId());
|
||||
|
|
|
@ -311,8 +311,8 @@ class Deletes extends Action
|
|||
}
|
||||
$relatedCollection = $dbForProject->getDocument('database_' . $databaseInternalId, $relationship['relatedCollection']);
|
||||
$dbForProject->deleteDocument('attributes', $databaseInternalId . '_' . $relatedCollection->getInternalId() . '_' . $relationship['twoWayKey']);
|
||||
$dbForProject->deleteCachedDocument('database_' . $databaseInternalId, $relatedCollection->getId());
|
||||
$dbForProject->deleteCachedCollection('database_' . $databaseInternalId . '_collection_' . $relatedCollection->getInternalId());
|
||||
$dbForProject->purgeCachedDocument('database_' . $databaseInternalId, $relatedCollection->getId());
|
||||
$dbForProject->purgeCachedCollection('database_' . $databaseInternalId . '_collection_' . $relatedCollection->getInternalId());
|
||||
}
|
||||
|
||||
$dbForProject->deleteCollection('database_' . $databaseInternalId . '_collection_' . $document->getInternalId());
|
||||
|
@ -370,7 +370,7 @@ class Deletes extends Action
|
|||
$dbForProject,
|
||||
function (Document $membership) use ($dbForProject) {
|
||||
$userId = $membership->getAttribute('userId');
|
||||
$dbForProject->deleteCachedDocument('users', $userId);
|
||||
$dbForProject->purgeCachedDocument('users', $userId);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -504,7 +504,7 @@ class Deletes extends Action
|
|||
Query::equal('userInternalId', [$userInternalId])
|
||||
], $dbForProject);
|
||||
|
||||
$dbForProject->deleteCachedDocument('users', $userId);
|
||||
$dbForProject->purgeCachedDocument('users', $userId);
|
||||
|
||||
// Delete Memberships and decrement team membership counts
|
||||
$this->deleteByGroup('memberships', [
|
||||
|
|
|
@ -220,7 +220,7 @@ class Migrations extends Action
|
|||
]);
|
||||
|
||||
$this->dbForConsole->createDocument('keys', $key);
|
||||
$this->dbForConsole->deleteCachedDocument('projects', $project->getId());
|
||||
$this->dbForConsole->purgeCachedDocument('projects', $project->getId());
|
||||
|
||||
return $key;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue