Exemplo n.º 1
0
 public static function sectionUFields($primary)
 {
     if (!$primary) {
         throw new ArgumentException('Не указан идентификатор инфоблока');
     }
     $cache = new \CPHPCache();
     $path = self::createPath(__METHOD__);
     $cacheId = md5($primary . $path);
     if ($cache->InitCache(86400 * 2, $cacheId, $path)) {
         $uFields = $cache->GetVars();
     } else {
         if (!is_numeric($primary)) {
             $iblock = self::iblock($primary);
             if (!$iblock) {
                 $cache->AbortDataCache();
                 return null;
             }
             $primary = $iblock['ID'];
         }
         global $USER_FIELD_MANAGER;
         $uFields = $USER_FIELD_MANAGER->getUserFields("IBLOCK_{$primary}_SECTION");
         if ($cache->StartDataCache()) {
             $cache->EndDataCache($uFields);
         }
     }
     return $uFields;
 }
Exemplo n.º 2
0
            }
        }
        $_SESSION['SENDER_SUBSCRIBE_LIST']['SUBSCRIPTION'] = $arSubscription;
        $_SESSION['SENDER_SUBSCRIBE_LIST']['RUBRIC'] = $arSubscriptionRubrics;
    }
}
//page title
if ($arParams["SET_TITLE"] == "Y") {
    $APPLICATION->SetTitle(GetMessage("SENDER_SUBSCR_TITLE"), array('COMPONENT_NAME' => $this->GetName()));
}
//get site's newsletter categories
$obCache = new CPHPCache();
$strCacheID = LANG . $arParams["SHOW_HIDDEN"];
if ($obCache->StartDataCache($arParams["CACHE_TIME"], $strCacheID, "/" . SITE_ID . $this->GetRelativePath())) {
    if (!CModule::IncludeModule("sender")) {
        $obCache->AbortDataCache();
        ShowError(GetMessage("SENDER_SUBSCR_MODULE_NOT_INSTALLED"));
        return;
    }
    $arFilter = array("SITE_ID" => SITE_ID);
    if (!$arParams["SHOW_HIDDEN"]) {
        $arFilter["IS_PUBLIC"] = "Y";
    }
    $mailingList = \Bitrix\Sender\Subscription::getMailingList($arFilter);
    $obCache->EndDataCache($mailingList);
} else {
    $mailingList = $obCache->GetVars();
}
if (strlen($_REQUEST["SENDER_SUBSCRIBE_EMAIL"]) > 0) {
    $arResult["EMAIL"] = htmlspecialcharsbx($_REQUEST["SENDER_SUBSCRIBE_EMAIL"]);
} elseif (strlen($arSubscription["EMAIL"]) > 0) {
Exemplo n.º 3
0
 public function GetStatusList($XML_ID = false)
 {
     if (is_array($this->CacheStorage["STATUS_LIST"]) && array_key_exists(intval($XML_ID), $this->CacheStorage["STATUS_LIST"])) {
         return $this->CacheStorage["STATUS_LIST"][intval($XML_ID)];
     }
     $obCache = new CPHPCache();
     $life_time = 60 * 60 * 24 * 30;
     //over 1 month
     $cache_id = 'idea_status_list';
     //no need to keep unique all time, just caching for 1 day if no changes
     $cache_path = '/' . SITE_ID . '/idea/status_list/';
     $arStatus = array();
     if ($obCache->StartDataCache($life_time, $cache_id, $cache_path)) {
         $arStatusField = CUserTypeEntity::GetList(array(), array("ENTITY_ID" => "BLOG_POST", "FIELD_NAME" => CIdeaManagment::UFStatusField))->Fetch();
         if ($arStatusField) {
             $oStatus = CUserFieldEnum::GetList(array(), array("USER_FIELD_ID" => $arStatusField["ID"]));
             while ($r = $oStatus->Fetch()) {
                 $arStatus[$r["ID"]] = $r;
             }
             $obCache->EndDataCache($arStatus);
         } else {
             $obCache->AbortDataCache();
         }
     } else {
         $arStatus = $obCache->GetVars();
     }
     if ($XML_ID) {
         $arStatusXML = array();
         foreach ($arStatus as $Status) {
             $arStatusXML[$Status["XML_ID"]] = $Status;
         }
         $arStatus = $arStatusXML;
     }
     return $this->CacheStorage["STATUS_LIST"][intval($XML_ID)] = $arStatus;
 }
Exemplo n.º 4
0
Arquivo: class.php Projeto: ASDAFF/mp
 /**
  * Read some data from database, using cache. Under some info we mean status list, delivery system list and so on.
  * This will be a shared cache between sale.personal.order.list and sale.personal.order.detail, so beware of collisions.
  * @throws Exception
  * @return void
  */
 protected function obtainDataReferences()
 {
     $obCache = new CPHPCache();
     if ($obCache->StartDataCache($this->arParams["CACHE_TIME"], LANGUAGE_ID . SITE_ID)) {
         try {
             $cachedData = array();
             /////////////////////
             /////////////////////
             // Person type
             $dbPType = CSalePersonType::GetList(array("SORT" => "ASC"));
             while ($arPType = $dbPType->Fetch()) {
                 $cachedData['PERSON_TYPE'][$arPType["ID"]] = $arPType;
             }
             // Tax list
             $dbTaxList = CSaleOrderTax::GetList(array("APPLY_ORDER" => "ASC"));
             while ($arTaxList = $dbTaxList->Fetch()) {
                 $cachedData['TAX'] = $arTaxList;
             }
             // Save statuses for Filter form
             $dbStatus = CSaleStatus::GetList(array("SORT" => "ASC"), array("LID" => LANGUAGE_ID));
             while ($arStatus = $dbStatus->Fetch()) {
                 $cachedData['STATUS'][$arStatus["ID"]] = $arStatus;
             }
             $dbPaySystem = CSalePaySystem::GetList(array("SORT" => "ASC"));
             while ($arPaySystem = $dbPaySystem->Fetch()) {
                 $cachedData['PAYSYS'][$arPaySystem["ID"]] = $arPaySystem;
             }
             $dbDelivery = CSaleDelivery::GetList(array("SORT" => "ASC"));
             while ($arDelivery = $dbDelivery->Fetch()) {
                 $cachedData['DELIVERY'][$arDelivery["ID"]] = $arDelivery;
             }
             $dbDelivery = CSaleDeliveryHandler::GetList(array(), array(array("SITE_ID" => SITE_ID)));
             while ($arDeliveryHandler = $dbDelivery->Fetch()) {
                 $cachedData['DELIVERY_HANDLERS'][$arDeliveryHandler["SID"]] = $arDeliveryHandler;
             }
             /////////////////////
             /////////////////////
         } catch (Exception $e) {
             $obCache->AbortDataCache();
             throw $e;
         }
         $obCache->EndDataCache($cachedData);
     } else {
         $cachedData = $obCache->GetVars();
     }
     $this->dbResult = array_merge($this->dbResult, $cachedData);
 }
Exemplo n.º 5
0
 /**
  * _getHlTablesList
  * @param bool $refresh_cache
  * @return bool
  * @throws \Bitrix\Main\ArgumentException
  */
 private function getHlTablesList($refresh_cache = false)
 {
     if (is_null(self::$_hlblock_list)) {
         $cache = new \CPHPCache();
         $cache_time = $this->getDefaultCacheTime();
         $cache_id = 'getHlTablesList';
         $cache_path = '/' . __CLASS__ . '/' . __METHOD__ . '/';
         if (!$refresh_cache && $cache->InitCache($cache_time, $cache_id, $cache_path)) {
             self::$_hlblock_list = $cache->GetVars();
         } else {
             $cache->StartDataCache($cache_time, $cache_id, $cache_path);
             $dbItems = HighloadBlockTable::GetList(array('select' => array('ID', 'NAME', 'TABLE_NAME')));
             while ($arItem = $dbItems->Fetch()) {
                 self::$_hlblock_list[strtoupper($arItem['NAME'])] = $arItem;
             }
             if (is_null(self::$_hlblock_list)) {
                 $cache->AbortDataCache();
             }
             $cache->EndDataCache(self::$_hlblock_list);
         }
     }
     return self::$_hlblock_list;
 }