From 8651b87244204e89b47da48f6c41298517a8c465 Mon Sep 17 00:00:00 2001 From: Pierre Date: Sat, 1 Jul 2017 10:49:07 +0200 Subject: [PATCH] Divided important users informations requests --- RestControllers/userController.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/RestControllers/userController.php b/RestControllers/userController.php index 1597cd6..e8e881d 100644 --- a/RestControllers/userController.php +++ b/RestControllers/userController.php @@ -86,8 +86,21 @@ class userController //No ID specified Rest_fatal_error(400, "Please specify at least one user ID !"); - //Try to get user infos - $userInfos = CS::get()->components->user->getMultipleUserInfos($usersID); + //Check if it is a wide request or not + if(count($usersID) <= 10) + //Try to get user infos + $userInfos = CS::get()->components->user->getMultipleUserInfos($usersID); + else { + //Divide request in multiples ones + $userInfos = array(); + foreach(array_chunk($usersID, 10) as $process_users_ID){ + + //Get informations about the IDS + foreach(CS::get()->components->user->getMultipleUserInfos($process_users_ID) as $key=>$val){ + $userInfos[$key] = $val; + } + } + } //Check if response is empty if(count($userInfos) == 0)