hotfix CCache and enable use cache

This commit is contained in:
rsgrinko committed 2021-12-03 22:53:11 +03:00
1 parent fa02e60b5d
commit d5bdfbc33c
4 files changed
+116 -97

No files matched your search

+10 -2
View File
@@ -69,8 +69,16 @@ function pre($arr, $stop = false) {
* @param int $userId
*/
function isHaveAccessToDevice($deviceId, $userId){
global $DB;
$arDevice = $DB->query('SELECT user FROM devices WHERE id="'.$deviceId.'"');
$cacheId = md5('isHaveAccessToDevice_'.$deviceId.'_'.$userId);
echo $cacheId;
if(CCache::checkCache($cacheId)){
$arDevice = CCache::getCache($cacheId);
} else {
global $DB;
$arDevice = $DB->query('SELECT user FROM devices WHERE id="'.$deviceId.'"');
CCache::writeCache($cacheId, $arDevice);
}
if($arDevice){
if($arDevice[0]['user'] == $userId){