From fe7eda2a4c01bd447a0876eb8b37228b7499d78d Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 28 Jul 2025 14:31:17 +0200 Subject: [PATCH] Move api counter at a better place --- htdocs/api/class/api_access.class.php | 8 -------- htdocs/api/index.php | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php index e409cbb02a9..c20575b3a6a 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -191,14 +191,6 @@ class DolibarrApiAccess implements iAuthenticate throw new RestException(401, $genericmessageerroruser); } - // TODO - // Increase counter of API access - if (getDolGlobalString('API_COUNTER_ENABLED')) { - include DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; - dolibarr_set_const($this->db, 'API_COUNTER_COUNT', getDolGlobalInt('API_COUNTER_COUNT') + 1); - //var_dump('eeee');exit; - } - // User seems valid $fuser->getrights(); diff --git a/htdocs/api/index.php b/htdocs/api/index.php index b824c7b97dc..0f2fe33991f 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -305,6 +305,14 @@ if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' && $moduleobject = $reg[1]; if ($moduleobject == 'explorer') { // If we call page to explore details of a service $moduleobject = $regbis[2]; + } else { + // TODO + // Increase counter of API access + if (getDolGlobalString('API_COUNTER_ENABLED')) { + include DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; + dolibarr_set_const($db, 'API_COUNTER_COUNT', getDolGlobalInt('API_COUNTER_COUNT') + 1); + //var_dump('eeee');exit; + } } $moduleobject = strtolower($moduleobject);