Exemplo n.º 1
0
 function ClearSingleUserCache($arFields)
 {
     if (!defined('BX_COMP_MANAGED_CACHE') || !BX_COMP_MANAGED_CACHE) {
         return true;
     }
     global $CACHE_MANAGER;
     $dbRes = CUser::GetList($by = "id", $order = "asc", array("ID_EQUAL_EXACT" => intval($arFields['ID'])), array('SELECT' => array('UF_DEPARTMENT')));
     $arRecacheFields = array('ACTIVE', 'LAST_NAME');
     $bRecache = false;
     if ($arOldFields = $dbRes->Fetch()) {
         if (isset($arFields['PERSONAL_BIRTHDAY']) && $arOldFields['PERSONAL_BIRTHDAY'] != $arFields['PERSONAL_BIRTHDAY']) {
             $CACHE_MANAGER->ClearByTag("intranet_birthday");
         }
         if (isset($arFields['UF_DEPARTMENT']) && is_array($arFields['UF_DEPARTMENT']) && $arFields['UF_DEPARTMENT'] != $arOldFields['UF_DEPARTMENT']) {
             if (!is_array($arOldFields['UF_DEPARTMENT'])) {
                 $arOldFields['UF_DEPARTMENT'] = array();
             }
             $arDepts = array_diff($arFields['UF_DEPARTMENT'], $arOldFields['UF_DEPARTMENT']);
             if (count($arDepts) > 0) {
                 $CACHE_MANAGER->ClearByTag('intranet_department_structure');
                 foreach ($arDepts as $dpt) {
                     $CACHE_MANAGER->ClearByTag('intranet_department_' . $dpt);
                 }
             }
         }
         foreach ($arRecacheFields as $fld) {
             if (isset($arFields[$fld]) && $arOldFields[$fld] != $arFields[$fld]) {
                 $bRecache = true;
                 break;
             }
         }
     }
     if (\CHTMLPagesCache::IsOn()) {
         \Bitrix\Intranet\Composite\CacheProvider::deleteUserCache(intval($arFields['ID']));
     }
     if ($bRecache) {
         CIntranetEventHandlers::ClearAllUsersCache($arFields['ID']);
     } else {
         $CACHE_MANAGER->ClearByTag("intranet_user_" . $arFields['ID']);
     }
     return true;
 }
Exemplo n.º 2
0
<?php

define("PUBLIC_AJAX_MODE", true);
define("NO_KEEP_STATISTIC", "Y");
define("NO_AGENT_STATISTIC", "Y");
define("NO_AGENT_CHECK", true);
define("NOT_CHECK_PERMISSIONS", true);
define("DisableEventsCheck", true);
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
if (check_bitrix_sessid() && isset($_GET["banner"]) && preg_match("/^[a-z0-9-_]+\$/i", $_GET["banner"])) {
    $moduleName = IsModuleInstalled("bitrix24") ? "bitrix24" : "intranet";
    $optionName = "banners";
    $banners = CUserOptions::GetOption($moduleName, $optionName, array());
    if (is_array($banners)) {
        $banners[$_GET["banner"]] = "Y";
        CUserOptions::SetOption($moduleName, $optionName, $banners);
    }
    \Bitrix\Intranet\Composite\CacheProvider::deleteUserCache();
}
die("");