From 79b1fceaf3f3e0d11071ce998b3727bfcd7d46e9 Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Wed, 27 Oct 2021 18:17:15 -0400 Subject: [PATCH] Rename to prevent collisions --- app/controllers/api/database.php | 16 ++++++++-------- app/controllers/api/functions.php | 8 ++++---- app/controllers/api/projects.php | 8 ++++---- app/controllers/api/storage.php | 16 ++++++++-------- app/controllers/api/users.php | 8 ++++---- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/app/controllers/api/database.php b/app/controllers/api/database.php index 1c1749a043..1c84c4d746 100644 --- a/app/controllers/api/database.php +++ b/app/controllers/api/database.php @@ -287,7 +287,7 @@ App::get('/v1/database/usage') $usage = []; if (App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') { - $period = [ + $periods = [ '24h' => [ 'period' => '30m', 'limit' => 48, @@ -321,10 +321,10 @@ App::get('/v1/database/usage') $stats = []; - Authorization::skip(function() use ($dbForInternal, $period, $range, $metrics, &$stats) { + Authorization::skip(function() use ($dbForInternal, $periods, $range, $metrics, &$stats) { foreach ($metrics as $metric) { - $limit = $period[$range]['limit']; - $period = $period[$range]['period']; + $limit = $periods[$range]['limit']; + $period = $periods[$range]['period']; $requestDocs = $dbForInternal->find('stats', [ new Query('period', Query::TYPE_EQUAL, [$period]), @@ -404,7 +404,7 @@ App::get('/v1/database/:collectionId/usage') $usage = []; if(App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') { - $period = [ + $periods = [ '24h' => [ 'period' => '30m', 'limit' => 48, @@ -433,10 +433,10 @@ App::get('/v1/database/:collectionId/usage') $stats = []; - Authorization::skip(function() use ($dbForInternal, $period, $range, $metrics, &$stats) { + Authorization::skip(function() use ($dbForInternal, $periods, $range, $metrics, &$stats) { foreach ($metrics as $metric) { - $limit = $period[$range]['limit']; - $period = $period[$range]['period']; + $limit = $periods[$range]['limit']; + $period = $periods[$range]['period']; $requestDocs = $dbForInternal->find('stats', [ new Query('period', Query::TYPE_EQUAL, [$period]), diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 679f4c8b1e..5857c3ccc7 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -176,7 +176,7 @@ App::get('/v1/functions/:functionId/usage') $usage = []; if(App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') { - $period = [ + $periods = [ '24h' => [ 'period' => '30m', 'limit' => 48, @@ -203,10 +203,10 @@ App::get('/v1/functions/:functionId/usage') $stats = []; - Authorization::skip(function() use ($dbForInternal, $period, $range, $metrics, &$stats) { + Authorization::skip(function() use ($dbForInternal, $periods, $range, $metrics, &$stats) { foreach ($metrics as $metric) { - $limit = $period[$range]['limit']; - $period = $period[$range]['period']; + $limit = $periods[$range]['limit']; + $period = $periods[$range]['period']; $requestDocs = $dbForInternal->find('stats', [ new Query('period', Query::TYPE_EQUAL, [$period]), diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 69b44ddc93..853e22ffd8 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -255,7 +255,7 @@ App::get('/v1/projects/:projectId/usage') $usage = []; if (App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') { - $period = [ + $periods = [ '24h' => [ 'period' => '30m', 'limit' => 48, @@ -288,10 +288,10 @@ App::get('/v1/projects/:projectId/usage') $stats = []; - Authorization::skip(function() use ($dbForInternal, $period, $range, $metrics, &$stats) { + Authorization::skip(function() use ($dbForInternal, $periods, $range, $metrics, &$stats) { foreach ($metrics as $metric) { - $limit = $period[$range]['limit']; - $period = $period[$range]['period']; + $limit = $periods[$range]['limit']; + $period = $periods[$range]['period']; $requestDocs = $dbForInternal->find('stats', [ new Query('period', Query::TYPE_EQUAL, [$period]), diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index d8abf494d3..b5151353e8 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -670,7 +670,7 @@ App::get('/v1/storage/usage') $usage = []; if (App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') { - $period = [ + $periods = [ '24h' => [ 'period' => '30m', 'limit' => 48, @@ -696,10 +696,10 @@ App::get('/v1/storage/usage') $stats = []; - Authorization::skip(function() use ($dbForInternal, $period, $range, $metrics, &$stats) { + Authorization::skip(function() use ($dbForInternal, $periods, $range, $metrics, &$stats) { foreach ($metrics as $metric) { - $limit = $period[$range]['limit']; - $period = $period[$range]['period']; + $limit = $periods[$range]['limit']; + $period = $periods[$range]['period']; $requestDocs = $dbForInternal->find('stats', [ new Query('period', Query::TYPE_EQUAL, [$period]), @@ -764,7 +764,7 @@ App::get('/v1/storage/:bucketId/usage') $usage = []; if (App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') { - $period = [ + $periods = [ '24h' => [ 'period' => '30m', 'limit' => 48, @@ -793,10 +793,10 @@ App::get('/v1/storage/:bucketId/usage') $stats = []; - Authorization::skip(function() use ($dbForInternal, $period, $range, $metrics, &$stats) { + Authorization::skip(function() use ($dbForInternal, $periods, $range, $metrics, &$stats) { foreach ($metrics as $metric) { - $limit = $period[$range]['limit']; - $period = $period[$range]['period']; + $limit = $periods[$range]['limit']; + $period = $periods[$range]['period']; $requestDocs = $dbForInternal->find('stats', [ new Query('period', Query::TYPE_EQUAL, [$period]), diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index dec653dd4c..6ea6bca091 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -780,7 +780,7 @@ App::get('/v1/users/usage') $usage = []; if (App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') { - $period = [ + $periods = [ '24h' => [ 'period' => '30m', 'limit' => 48, @@ -812,10 +812,10 @@ App::get('/v1/users/usage') $stats = []; - Authorization::skip(function() use ($dbForInternal, $period, $range, $metrics, &$stats) { + Authorization::skip(function() use ($dbForInternal, $periods, $range, $metrics, &$stats) { foreach ($metrics as $metric) { - $limit = $period[$range]['limit']; - $period = $period[$range]['period']; + $limit = $periods[$range]['limit']; + $period = $periods[$range]['period']; $requestDocs = $dbForInternal->find('stats', [ new Query('period', Query::TYPE_EQUAL, [$period]),