1
0
Fork 0
mirror of synced 2024-06-26 18:20:43 +12:00

refactoring with suggested updates

This commit is contained in:
Damodar Lohani 2021-01-13 12:10:43 +05:45
parent d345aac92f
commit 379ce3abce
4 changed files with 7 additions and 8 deletions

View file

@ -156,9 +156,8 @@ App::get('/v1/functions/:functionId/usage')
if (empty($function->getId()) || Database::SYSTEM_COLLECTION_FUNCTIONS != $function->getCollection()) {
throw new Exception('Function not found', 404);
}
//check if stats is disabled
$appUsageStatsEnabled = App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled';
if($appUsageStatsEnabled) {
if($App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') {
$period = [
'24h' => [
'start' => DateTime::createFromFormat('U', \strtotime('-24 hours')),

View file

@ -176,8 +176,7 @@ App::get('/v1/projects/:projectId/usage')
throw new Exception('Project not found', 404);
}
$appUsageStatsEnabled = App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled';
if($appUsageStatsEnabled) {
if($App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') {
$period = [
'24h' => [

View file

@ -122,7 +122,8 @@ App::get('/console/home')
/** @var Utopia\View $layout */
$page = new View(__DIR__.'/../../views/console/home/index.phtml');
$page->setParam('usageStatsEnabled',App::getEnv('_APP_USAGE_STATS','enabled') == 'enabled');
$page
->setParam('usageStatsEnabled',App::getEnv('_APP_USAGE_STATS','enabled') == 'enabled');
$layout
->setParam('title', APP_NAME.' - Console')
->setParam('body', $page);

View file

@ -470,8 +470,8 @@ class FunctionsV1
->setParam('networkRequestSize', 0)
->setParam('networkResponseSize', 0)
;
$appUsageStatsEnabled = App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled';
if($appUsageStatsEnabled) {
if($App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') {
$usage->trigger();
}