Updated error when _APP_USAGE_STATS is disabled

for usage
This commit is contained in:
Bhaskar Singh
2023-03-18 22:12:36 +05:30
parent e8c74d7204
commit ac2085ffa8
8 changed files with 34 additions and 1 deletions
+9
View File
@@ -2471,6 +2471,9 @@ App::get('/v1/databases/usage')
->action(function (string $range, Response $response, Database $dbForProject) {
$usage = [];
if (App::getEnv('_APP_USAGE_STATS', 'enabled') != 'enabled') {
throw new Exception(Exception::GENERAL_USAGE_DISABLED);
}
if (App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') {
$periods = [
'24h' => [
@@ -2590,6 +2593,9 @@ App::get('/v1/databases/:databaseId/usage')
->action(function (string $databaseId, string $range, Response $response, Database $dbForProject) {
$usage = [];
if (App::getEnv('_APP_USAGE_STATS', 'enabled') != 'enabled') {
throw new Exception(Exception::GENERAL_USAGE_DISABLED);
}
if (App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') {
$periods = [
'24h' => [
@@ -2710,6 +2716,9 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/usage')
}
$usage = [];
if (App::getEnv('_APP_USAGE_STATS', 'enabled') != 'enabled') {
throw new Exception(Exception::GENERAL_USAGE_DISABLED);
}
if (App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') {
$periods = [
'24h' => [