• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Data\Cache类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Bitrix\Main\Data\Cache的典型用法代码示例。如果您正苦于以下问题:PHP Cache类的具体用法?PHP Cache怎么用?PHP Cache使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Cache类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: getIblocks

/**
 * Обёртка, кэширующая результаты _getIblocks() в глобальный массив $arIb
 */
function getIblocks()
{
    global $arIb;
    $obCache = \Bitrix\Main\Data\Cache::createInstance();
    $cacheTime = 86400;
    $cacheId = md5('s1');
    $cachePath = "iblocks";
    if ($obCache->initCache($cacheTime, $cacheId, $cachePath)) {
        $vars = $obCache->getVars();
        $arIb = $vars["arIb"];
    } elseif ($obCache->startDataCache()) {
        $arIb = _getIblocks();
        $obCache->endDataCache(array("arIb" => $arIb));
    }
}
开发者ID:rschweppes,项目名称:bitrix-helpers,代码行数:18,代码来源:getiblocks.php


示例2: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $dir = $input->getOption('dir');
     $tag = $input->getOption('tag');
     $cache = Cache::createInstance();
     if (empty($dir) && empty($tag)) {
         Application::getInstance()->getManagedCache()->cleanAll();
         $cache->cleanDir();
         $cache->cleanDir(false, 'stack_cache');
         StaticHtmlCache::getInstance()->deleteAll();
         if (Cache::clearCache(true)) {
             $output->writeln('<info>All Bitrix cache was deleted</info>');
         } else {
             $output->writeln('<error>Error deleting Bitrix cache</error>');
         }
     }
     if ($dir) {
         $cache->cleanDir($dir);
         $output->writeln('<info>Bitrix cache by "/' . BX_ROOT . '/cache/' . $dir . '" dir was deleted</info>');
     }
     if ($tag) {
         Application::getInstance()->getTaggedCache()->clearByTag($tag);
         $output->writeln('<info>Bitrix cache by tag "' . $tag . '" was deleted</info>');
     }
 }
开发者ID:notamedia,项目名称:console-jedi,代码行数:28,代码来源:ClearCommand.php


示例3: restoreDebugMode

 public static function restoreDebugMode()
 {
     global $DB, $APPLICATION;
     $toRestore = explode("|", constant("PERFMON_STARTED"));
     $DB->ShowSqlStat = $toRestore[0];
     \Bitrix\Main\Data\Cache::setShowCacheStat($toRestore[1]);
     $APPLICATION->ShowIncludeStat = $toRestore[2];
 }
开发者ID:rasuldev,项目名称:torino,代码行数:8,代码来源:keeper.php


示例4: read

 /**
  * @param bool $isArray
  * @return null
  */
 protected function read($isArray = false)
 {
     $value = $isArray ? array() : null;
     if (!$this->beenWrite && \Bitrix\Main\Data\Cache::shouldClearCache()) {
         $this->clear();
     }
     $this->timeLive && $this->original->read($value, $this->baseDir(), $this->bxInitDir, $this->key, $this->timeLive);
     return $value;
 }
开发者ID:Under5,项目名称:bitrix-module-tools,代码行数:13,代码来源:cache.php


示例5: getPropertiesEx

function getPropertiesEx($arParams)
{
    $obCache = \Bitrix\Main\Data\Cache::createInstance();
    $cacheTime = 86400;
    $cacheId = md5($arParams);
    $cachePath = "properties";
    $arProperties = array();
    if ($obCache->initCache($cacheTime, $cacheId, $cachePath)) {
        $vars = $obCache->getVars();
        $arProperties = $vars["arProperties"];
    } elseif ($obCache->startDataCache()) {
        $arProperties = _getPropertiesEx($arParams);
        $obCache->endDataCache(array("arProperties" => $arProperties));
    }
    return $arProperties;
}
开发者ID:rschweppes,项目名称:bitrix-helpers,代码行数:16,代码来源:getproperties.php


示例6: onUserSetLastActivityDate

 public function onUserSetLastActivityDate(\Bitrix\Main\Event $event)
 {
     $users = $event->getParameter(0);
     foreach ($users as $userId) {
         $cache = \Bitrix\Main\Data\Cache::createInstance();
         if ($cache->startDataCache(60, $userId, '/im/status')) {
             $mapper = \Bitrix\Replica\Mapper::getInstance();
             $map = $mapper->getByPrimaryValue("b_im_status.USER_ID", false, $userId);
             if ($map) {
                 $guid = \Bitrix\Replica\Client\User::getLocalUserGuid($userId);
                 if ($guid && $map[$guid]) {
                     $event = array("operation" => "im_status_update", "guid" => $guid);
                     \Bitrix\Replica\Log\Client::getInstance()->write($map[$guid], $event);
                 }
             }
             $cache->endDataCache(true);
         }
     }
 }
开发者ID:Satariall,项目名称:izurit,代码行数:19,代码来源:statushandler.php


示例7: getUserGroupWithStorage

 protected function getUserGroupWithStorage()
 {
     if (!\CBXFeatures::isFeatureEnabled("Workgroups")) {
         return array();
     }
     if (!Loader::includeModule('socialnetwork')) {
         return array();
     }
     $userId = $this->getUser()->getId();
     $currentPossibleUserGroups = $currentUserGroups = array();
     $cache = Cache::createInstance();
     $cacheTtl = defined('BX_COMP_MANAGED_CACHE') ? 3153600 : 3600 * 4;
     $cachePath = "/disk/uf/{$userId}";
     if ($cache->initCache($cacheTtl, 'group_storage_list_' . SITE_ID . '_' . $userId, $cachePath)) {
         list($currentUserGroups) = $cache->getVars();
     } else {
         $cache->startDataCache();
         $taggedCache = Application::getInstance()->getTaggedCache();
         $taggedCache->startTagCache($cachePath);
         $diskSecurityContext = new DiskSecurityContext($userId);
         $storages = Storage::getReadableList($diskSecurityContext, array('filter' => array('STORAGE.ENTITY_TYPE' => ProxyType\Group::className())));
         foreach ($storages as $storage) {
             $currentPossibleUserGroups[$storage->getEntityId()] = $storage;
         }
         unset($storage);
         $query = \CSocNetUserToGroup::getList(array('GROUP_NAME' => 'ASC'), array('USER_ID' => $userId, 'GROUP_ID' => array_keys($currentPossibleUserGroups)), false, false, array('GROUP_ID', 'GROUP_NAME', 'GROUP_ACTIVE', 'GROUP_CLOSED', 'ROLE'));
         while ($row = $query->getNext()) {
             if ($row['GROUP_ACTIVE'] == 'Y' && $row['GROUP_CLOSED'] == 'N' && $row['ROLE'] != SONET_ROLES_BAN && $row['ROLE'] != SONET_ROLES_REQUEST && isset($currentPossibleUserGroups[$row['GROUP_ID']])) {
                 $taggedCache->registerTag("sonet_features_G_{$row['GROUP_ID']}");
                 $taggedCache->registerTag("sonet_group_{$row['GROUP_ID']}");
                 $currentUserGroups[$row['GROUP_ID']] = array('STORAGE' => $currentPossibleUserGroups[$row['GROUP_ID']], 'NAME' => $row['GROUP_NAME']);
             }
         }
         $taggedCache->registerTag("sonet_user2group_U{$userId}");
         $taggedCache->endTagCache();
         $cache->endDataCache(array($currentUserGroups));
     }
     return $currentUserGroups;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:39,代码来源:controller.php


示例8: startResultCache

 /**
  * Function starts the caching block of the component execution.
  *
  * @param int|bool $cacheTime
  * @param mixed $additionalCacheID
  * @param string|bool $cachePath
  * @return string
  *
  */
 public final function startResultCache($cacheTime = false, $additionalCacheID = false, $cachePath = false)
 {
     /** @global CMain $APPLICATION */
     global $APPLICATION, $CACHE_MANAGER;
     if (!$this->__bInited) {
         return null;
     }
     if ($this->arParams["CACHE_TYPE"] == "N" || $this->arParams["CACHE_TYPE"] == "A" && COption::getOptionString("main", "component_cache_on", "Y") == "N") {
         return true;
     }
     if ($cacheTime === false) {
         $cacheTime = intval($this->arParams["CACHE_TIME"]);
     }
     $this->__cacheID = $this->getCacheID($additionalCacheID);
     $this->__cachePath = $cachePath;
     if ($this->__cachePath === false) {
         $this->__cachePath = $CACHE_MANAGER->getCompCachePath($this->__relativePath);
     }
     $this->__cache = \Bitrix\Main\Data\Cache::createInstance();
     if ($this->__cache->startDataCache($cacheTime, $this->__cacheID, $this->__cachePath)) {
         $this->__NavNum = $GLOBALS["NavNum"];
         if (defined("BX_COMP_MANAGED_CACHE") && $this->__cache->isStarted()) {
             $CACHE_MANAGER->startTagCache($this->__cachePath);
         }
         return true;
     } else {
         $arCache = $this->__cache->GetVars();
         $this->arResult = $arCache["arResult"];
         if (array_key_exists("templateCachedData", $arCache)) {
             $templateCachedData =& $arCache["templateCachedData"];
             if ($templateCachedData && is_array($templateCachedData)) {
                 if (array_key_exists("additionalCSS", $templateCachedData) && strlen($templateCachedData["additionalCSS"]) > 0) {
                     $APPLICATION->SetAdditionalCSS($templateCachedData["additionalCSS"]);
                     if ($this->__parent) {
                         $this->__parent->addChildCSS($templateCachedData["additionalCSS"]);
                     }
                 }
                 if (array_key_exists("additionalJS", $templateCachedData) && strlen($templateCachedData["additionalJS"]) > 0) {
                     $APPLICATION->AddHeadScript($templateCachedData["additionalJS"]);
                     if ($this->__parent) {
                         $this->__parent->addChildJS($templateCachedData["additionalJS"]);
                     }
                 }
                 if (array_key_exists("frames", $templateCachedData) && is_array($templateCachedData["frames"])) {
                     foreach ($templateCachedData["frames"] as $frameState) {
                         \Bitrix\Main\Page\FrameHelper::applyCachedData($frameState);
                     }
                 }
                 if (array_key_exists("frameMode", $templateCachedData) && $templateCachedData["frameMode"] === false) {
                     $context = isset($templateCachedData["frameModeCtx"]) ? "(from component cache) " . $templateCachedData["frameModeCtx"] : $this->__name . " - a cached template set frameMode=false";
                     \Bitrix\Main\Data\StaticHtmlCache::applyComponentFrameMode($context);
                 }
                 if (isset($templateCachedData["externalCss"])) {
                     foreach ($templateCachedData["externalCss"] as $cssPath) {
                         $APPLICATION->SetAdditionalCSS($cssPath);
                         //Check if parent component exists and plug css it to it's "collection"
                         if ($this->__parent) {
                             $this->__parent->addChildCSS($cssPath);
                         }
                     }
                 }
                 if (isset($templateCachedData["externalJs"])) {
                     foreach ($templateCachedData["externalJs"] as $jsPath) {
                         $APPLICATION->AddHeadScript($jsPath);
                         //Check if parent component exists and plug js it to it's "collection"
                         if ($this->__parent) {
                             $this->__parent->addChildJS($jsPath);
                         }
                     }
                 }
             }
             if ($templateCachedData["__editButtons"]) {
                 foreach ($templateCachedData["__editButtons"] as $button) {
                     if ($button[0] == 'AddEditAction') {
                         $this->addEditAction($button[1], $button[2], $button[3], $button[4]);
                     } else {
                         $this->addDeleteAction($button[1], $button[2], $button[3], $button[4]);
                     }
                 }
             }
             if ($templateCachedData["__view"]) {
                 foreach ($templateCachedData["__view"] as $view_id => $target) {
                     foreach ($target as $view_content) {
                         $APPLICATION->addViewContent($view_id, $view_content[0], $view_content[1]);
                     }
                 }
             }
             if (array_key_exists("__NavNum", $templateCachedData)) {
                 $GLOBALS["NavNum"] += $templateCachedData["__NavNum"];
             }
             if (array_key_exists("__children_css", $templateCachedData)) {
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:component.php


示例9: getFromCache

 /**
  * Returns items from cache. If cache expired will be executed request to DB (method $this->getItems()).
  *
  * @param array $filter Parameters for filter.
  * @param string $shard Shard of the cache.
  *
  * @return mixed
  *
  * @throws ValueNotFoundException Value was not found.
  * @throws \InvalidArgumentException Invalid type on filter.
  */
 protected function getFromCache($filter = [], $shard = null)
 {
     $filter = $this->prepareFilter($filter);
     $cache = Cache::createInstance();
     if ($cache->initCache(static::getCacheTime(), null, static::getCacheDir() . '/' . $shard)) {
         $items = $cache->getVars();
     } else {
         $cache->startDataCache();
         Application::getInstance()->getTaggedCache()->startTagCache(static::getCacheDir() . '/' . $shard);
         $items = $this->getItems($shard);
         if (!empty($items)) {
             Application::getInstance()->getTaggedCache()->endTagCache();
             $cache->endDataCache($items);
         } else {
             $cache->abortDataCache();
         }
     }
     try {
         return $this->getValue($items, $filter, $shard);
     } catch (ValueNotFoundException $e) {
         if ($this->silenceMode) {
             return null;
         }
         throw $e;
     }
 }
开发者ID:bitrix-expert,项目名称:tools,代码行数:37,代码来源:Finder.php


示例10: loadFormattedFolderTreeAndBreadcrumbs

 private function loadFormattedFolderTreeAndBreadcrumbs($returnTree = false)
 {
     $cache = Data\Cache::createInstance();
     if ($cache->initCache(15768000, 'storage_tr_' . $this->storage->getId(), 'disk')) {
         list($formattedFolders, $this->cacheBreadcrumbs) = $cache->getVars();
     } else {
         $querySharedFolders = \Bitrix\Disk\Sharing::getList(array('filter' => array('FROM_ENTITY' => Sharing::CODE_USER . $this->getUser()->getId(), '!TO_ENTITY' => Sharing::CODE_USER . $this->getUser()->getId())));
         $sharedFolders = array();
         while ($sharedFolder = $querySharedFolders->fetch()) {
             $sharedFolders[$sharedFolder['REAL_OBJECT_ID']] = $sharedFolder['REAL_OBJECT_ID'];
         }
         $formattedFolders = array();
         foreach ($this->walkAndBuildTree($this->storage->getRootObject()) as $folder) {
             /** @var Folder $folder */
             $formattedFolders[] = $this->formatFolderToResponse($folder, isset($sharedFolders[$folder->getId()]));
         }
         unset($folder);
         $cache->startDataCache();
         $cache->endDataCache(array($formattedFolders, $this->cacheBreadcrumbs));
     }
     return $returnTree ? $formattedFolders : null;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:22,代码来源:diskstorage.php


示例11: Save

 public function Save()
 {
     if (defined("BITRIX_SKIP_STACK_CACHE") && BITRIX_SKIP_STACK_CACHE) {
         return;
     }
     global $DB;
     if (!$this->cleanSet || !$this->cleanGet && count($this->values) >= $this->len) {
         $objCache = \Bitrix\Main\Data\Cache::createInstance();
         //Force cache rewrite
         $saveClearState = $objCache->setClearCache(true);
         if ($objCache->StartDataCache($this->ttl, $this->entity, $DB->type . "/" . $this->entity, $this->values, "stack_cache")) {
             $objCache->EndDataCache();
         }
         $objCache->setClearCache($saveClearState);
         $this->cleanGet = true;
         $this->cleanSet = true;
     }
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:18,代码来源:cache.php


示例12: define

 * @global CMain $APPLICATION
 * @global CDatabase $DB
 */
define("START_EXEC_EPILOG_AFTER_1", microtime());
$GLOBALS["BX_STATE"] = "EA";
global $USER, $APPLICATION, $DB;
foreach (GetModuleEvents("main", "OnEpilog", true) as $arEvent) {
    ExecuteModuleEventEx($arEvent);
}
$r = $APPLICATION->EndBufferContentMan();
$main_exec_time = round(getmicrotime() - START_EXEC_TIME, 4);
echo $r;
$arAllEvents = GetModuleEvents("main", "OnAfterEpilog", true);
define("START_EXEC_EVENTS_1", microtime());
$GLOBALS["BX_STATE"] = "EV";
CMain::EpilogActions();
define("START_EXEC_EVENTS_2", microtime());
$GLOBALS["BX_STATE"] = "EA";
foreach ($arAllEvents as $arEvent) {
    ExecuteModuleEventEx($arEvent);
}
if (!IsModuleInstalled("compression") && !defined("ADMIN_AJAX_MODE") && $_REQUEST["mode"] != 'excel') {
    $bShowTime = $_SESSION["SESS_SHOW_TIME_EXEC"] == 'Y';
    $bShowStat = $DB->ShowSqlStat && $USER->CanDoOperation('edit_php');
    $bShowCacheStat = \Bitrix\Main\Data\Cache::getShowCacheStat() && ($canEditPHP || $_SESSION["SHOW_CACHE_STAT"] == "Y");
    if ($bShowTime || $bShowStat || $bShowCacheStat) {
        include_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/interface/debug_info.php";
    }
}
$DB->Disconnect();
CMain::ForkActions();
开发者ID:spas-viktor,项目名称:books,代码行数:31,代码来源:epilog_admin_after.php


示例13: getListEx

/**
 * Обёртка, кэширующая результаты _getListEx()
 *
 * Возможные параметры $arOptions:
 * - *iblock_id* - ID или символьный код инфоблока
 * - *filter* - Параметры фильтра
 * - *sort* - Параметры сортировки
 * - *select* - Поля для выборки
 * - *get_sections* - *true*, если нужно выбрать секции, а не элементы
 * - *id_key* - *true*, если ключи результирующего массива
 *              должны принять значения ID элемента:<br>
 *              <code>array(ID1 => array(...), ID2 => array(...))</code><br>
 *              Если параметр равен *false*, массив будет неассоциативным:<br>
 *              <code>array(array(...), array(...))</code>
 * - *is_sub_query* - Если *true*, результат выборки будет оформлен для фильтрации в другом _getListEx()
 * - *cache_time* - Время хранения кэша
 * - *nav* — Параметры для постраничной навигации, формируются, как в стандартном GetList()
 *           https://dev.1c-bitrix.ru/api_help/iblock/classes/ciblockelement/getlist.php
 * 
 * @example getlistex.php Выбор всех компаний, у которых есть офис в Ярославле. Пример вложенных getListEx
 * @param  array $arOptions Параметры выборки
 * @return array            Массив с результатами выборки
 */
function getListEx($arOptions)
{
    $iblockId = iblock($arOptions['iblock_id']);
    if ($iblockId === false) {
        return false;
    }
    $obCache = \Bitrix\Main\Data\Cache::createInstance();
    $cacheTime = intval($arOptions['cache_time']) > 0 ? intval($arOptions['cache_time']) : 3600;
    $cacheId = md5(serialize($arOptions));
    $cachePath = '/lists_ex/' . $iblockId . '/';
    $arElements = array();
    if ($obCache->initCache($cacheTime, $cacheId, $cachePath)) {
        $vars = $obCache->getVars();
        $arElements = $vars['arElements'];
    } elseif ($obCache->startDataCache()) {
        global $CACHE_MANAGER;
        $CACHE_MANAGER->StartTagCache($cachePath);
        $CACHE_MANAGER->RegisterTag('iblock_id_' . $iblockId);
        $arElements = _getListEx($arOptions);
        foreach ($arElements as $arElement) {
            if (isset($arElement["ID"])) {
                $CACHE_MANAGER->RegisterTag("element_" . $arElement["ID"]);
            }
            if (!is_array($arElement) && intval($arElement) > 0) {
                $CACHE_MANAGER->RegisterTag("element_" . intval($arElement));
            }
        }
        $CACHE_MANAGER->EndTagCache();
        $obCache->endDataCache(array('arElements' => $arElements));
    }
    return $arElements;
}
开发者ID:rschweppes,项目名称:bitrix-helpers,代码行数:55,代码来源:getlist.php


示例14: getCache

 /**
  * Returns new instance of the Cache object.
  *
  * @return Data\Cache
  */
 public function getCache()
 {
     return \Bitrix\Main\Data\Cache::createInstance();
 }
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:9,代码来源:application.php


示例15: save

 public function save()
 {
     Config\Option::set('security', $this->optionPrefix . 'hosts', $this->hosts, '');
     Config\Option::set('security', $this->optionPrefix . 'action', $this->action, '');
     Config\Option::set('security', $this->optionPrefix . 'action_options', serialize($this->actionOptions), '');
     Config\Option::set('security', $this->optionPrefix . 'logging', $this->isLogNeeded, '');
     if (!is_null($this->isActive)) {
         if ($this->isActive) {
             EventManager::getInstance()->registerEventHandler('main', 'OnPageStart', 'security', get_class($this), 'onPageStart');
         } else {
             EventManager::getInstance()->unRegisterEventHandler('main', 'OnPageStart', 'security', get_class($this), 'onPageStart');
         }
     }
     Data\Cache::createInstance()->clean($this->cacheId);
 }
开发者ID:spas-viktor,项目名称:books,代码行数:15,代码来源:hostrestriction.php


示例16: GetStandardButtons


//.........这里部分代码省略.........
         $arOperations = CUser::GetFileOperations(array(SITE_ID, $currentFilePath), array(2));
         $bAllowAnonymous = in_array("fm_view_file", $arOperations);
         $APPLICATION->AddPanelButton(array("HREF" => $defaultUrl == "" ? "" : "javascript:" . $defaultUrl, "TYPE" => "BIG", "ID" => "edit", "ICON" => $bAllowAnonymous ? "bx-panel-edit-page-icon" : "bx-panel-edit-secret-page-icon", "ALT" => GetMessage("top_panel_edit_title"), "TEXT" => GetMessage("top_panel_edit_new"), "MAIN_SORT" => "200", "SORT" => 10, "MENU" => $arMenu, "HK_ID" => "top_panel_edit_new", "RESORT_MENU" => true, "HINT" => array("TITLE" => GetMessage("top_panel_edit_new_tooltip_title"), "TEXT" => GetMessage("top_panel_edit_new_tooltip")), "HINT_MENU" => array("TITLE" => GetMessage("top_panel_edit_new_menu_tooltip_title"), "TEXT" => GetMessage("top_panel_edit_new_menu_tooltip"))));
     }
     // EDIT SECTION button
     $arMenu = array();
     if (CTopPanel::IsCanEditSection($currentDirPath, $filemanExists)) {
         $defaultUrl = 'javascript:' . $APPLICATION->GetPopupLink(array("URL" => "/bitrix/admin/public_folder_edit.php?lang=" . LANGUAGE_ID . "&site=" . SITE_ID . "&path=" . urlencode($APPLICATION->GetCurDir()) . "&back_url=" . $encRequestUri, "PARAMS" => array("min_width" => 450, "min_height" => 250)));
         $arMenu[] = array("TEXT" => GetMessage("top_panel_folder_prop"), "TITLE" => GetMessage("top_panel_folder_prop_title"), "ICON" => "panel-folder-props", "DEFAULT" => true, "ACTION" => $defaultUrl, "SORT" => 10, "HK_ID" => "top_panel_folder_prop");
     }
     if (CTopPanel::IsCanEditPermission($currentDirPath, $documentRoot, $filemanExists)) {
         $arMenu[] = array("TEXT" => GetMessage("top_panel_access_folder_new"), "TITLE" => GetMessage("top_panel_access_folder_title"), "ICON" => "panel-folder-access", "ACTION" => $APPLICATION->GetPopupLink(array("URL" => "/bitrix/admin/public_access_edit.php?lang=" . LANGUAGE_ID . "&site=" . SITE_ID . "&path=" . $encCurrentDirPath . "&back_url=" . $encRequestUri, "PARAMS" => array("min_width" => 450, "min_height" => 250))), "SORT" => 30, "HK_ID" => "top_panel_access_folder_new");
     }
     if (!empty($arMenu)) {
         //check anonymous access
         $arOperations = CUser::GetFileOperations(array(SITE_ID, $currentDirPath), array(2));
         $bAllowAnonymous = in_array("fm_view_listing", $arOperations);
         $APPLICATION->AddPanelButton(array("HREF" => $defaultUrl, "ID" => 'edit_section', "TYPE" => "BIG", "TEXT" => GetMessage("top_panel_folder_prop_new"), "TITLE" => GetMessage("top_panel_folder_prop_title"), "ICON" => $bAllowAnonymous ? "bx-panel-edit-section-icon" : "bx-panel-edit-secret-section-icon", "MAIN_SORT" => "200", "SORT" => 20, "MENU" => $arMenu, "HK_ID" => "top_panel_folder_prop_new", "RESORT_MENU" => true, "HINT" => array("TITLE" => GetMessage("top_panel_folder_prop_new_tooltip_title"), "TEXT" => GetMessage("top_panel_folder_prop_new_tooltip")), "HINT_MENU" => array("TITLE" => GetMessage("top_panel_folder_prop_new_menu_tooltip_title"), "TEXT" => GetMessage("top_panel_folder_prop_new_menu_tooltip"))));
     }
     // STRUCTURE button and submenu
     if ($USER->CanDoOperation('fileman_view_file_structure') && $USER->CanDoFileOperation('fm_edit_existent_folder', array(SITE_ID, "/"))) {
         $defaultUrl = $APPLICATION->GetPopupLink(array("URL" => "/bitrix/admin/public_structure.php?lang=" . LANGUAGE_ID . "&site=" . SITE_ID . "&path=" . $encCurrentFilePath . "&templateID=" . $encSiteTemplateId, "PARAMS" => array("width" => 350, "height" => 470, "resize" => true)));
         $arMenu = array();
         if ($filemanExists) {
             $arMenu[] = array("TEXT" => GetMessage("main_top_panel_struct"), "TITLE" => GetMessage("main_top_panel_struct_title"), "ACTION" => $defaultUrl, "DEFAULT" => true, "HK_ID" => "main_top_panel_struct");
             $arMenu[] = array('SEPARATOR' => true);
             $arMenu[] = array("TEXT" => GetMessage("main_top_panel_struct_panel"), "TITLE" => GetMessage("main_top_panel_struct_panel_title"), "ACTION" => "jsUtils.Redirect([], '" . CUtil::JSEscape("/bitrix/admin/fileman_admin.php?lang=" . LANGUAGE_ID . "&site=" . SITE_ID . "&path=" . urlencode($APPLICATION->GetCurDir())) . "')", "HK_ID" => "main_top_panel_struct_panel");
         }
         $APPLICATION->AddPanelButton(array("HREF" => "javascript:" . $defaultUrl, "ID" => "structure", "ICON" => "bx-panel-site-structure-icon", "ALT" => GetMessage("main_top_panel_struct_title"), "TEXT" => GetMessage("main_top_panel_structure"), "MAIN_SORT" => "300", "SORT" => 30, "MENU" => $arMenu, "HK_ID" => "main_top_panel_structure", "HINT" => array("TITLE" => GetMessage("main_top_panel_structure_tooltip_title"), "TEXT" => GetMessage("main_top_panel_structure_tooltip"))));
     }
     //cache button
     if ($USER->CanDoOperation("cache_control")) {
         //recreate cache on the current page
         $arMenu = array(array("TEXT" => GetMessage("top_panel_cache_page"), "TITLE" => GetMessage("top_panel_cache_page_title"), "ICON" => "panel-page-cache", "ACTION" => "BX.clearCache()", "DEFAULT" => true, "HK_ID" => "top_panel_cache_page"));
         if (!empty($APPLICATION->aCachedComponents)) {
             $arMenu[] = array("TEXT" => GetMessage("top_panel_cache_comp"), "TITLE" => GetMessage("top_panel_cache_comp_title"), "ICON" => "panel-comp-cache", "ACTION" => "jsComponentUtils.ClearCache('component_name=" . CUtil::addslashes(implode(",", $APPLICATION->aCachedComponents)) . "&site_id=" . SITE_ID . "');", "HK_ID" => "top_panel_cache_comp");
         }
         $arMenu[] = array("SEPARATOR" => true);
         $sessionClearCache = isset($_SESSION["SESS_CLEAR_CACHE"]) && $_SESSION["SESS_CLEAR_CACHE"] == "Y";
         $arMenu[] = array("TEXT" => GetMessage("top_panel_cache_not"), "TITLE" => GetMessage("top_panel_cache_not_title"), "CHECKED" => $sessionClearCache, "ACTION" => "jsUtils.Redirect([], '" . CUtil::addslashes($APPLICATION->GetCurPageParam("clear_cache_session=" . ($sessionClearCache ? "N" : "Y"), array("clear_cache_session"))) . "');", "HK_ID" => "top_panel_cache_not");
         $APPLICATION->AddPanelButton(array("HREF" => "javascript:BX.clearCache()", "TYPE" => "BIG", "ICON" => "bx-panel-clear-cache-icon", "TEXT" => GetMessage("top_panel_cache_new"), "ALT" => GetMessage("top_panel_clear_cache"), "MAIN_SORT" => "400", "SORT" => 10, "MENU" => $arMenu, "HK_ID" => "top_panel_clear_cache", "HINT" => array("TITLE" => GetMessage("top_panel_cache_new_tooltip_title"), "TEXT" => GetMessage("top_panel_cache_new_tooltip")), "HINT_MENU" => array("TITLE" => GetMessage("top_panel_cache_new_menu_tooltip_title"), "TEXT" => GetMessage("top_panel_cache_new_menu_tooltip"))));
     }
     $bHideComponentsMenu = false;
     if ($USER->CanDoOperation('edit_php') || !empty($APPLICATION->arPanelFutureButtons['components'])) {
         if (empty($APPLICATION->arPanelFutureButtons['components'])) {
             if ($APPLICATION->GetShowIncludeAreas() != 'Y') {
                 $APPLICATION->AddPanelButtonMenu('components', array("TEXT" => GetMessage("top_panel_edit_mode"), "TITLE" => GetMessage("top_panel_edit_mode_title"), "ACTION" => "jsUtils.Redirect([], BX('bx-panel-toggle').href);", "HK_ID" => "top_panel_edit_mode"));
             } else {
                 $bHideComponentsMenu = true;
             }
         }
         if ($bHideComponentsMenu) {
             $APPLICATION->AddPanelButton(array("ID" => "components_empty", "HREF" => "javascript:void(0)", "ICON" => "bx-panel-components-icon", "TEXT" => GetMessage("top_panel_comp"), "MAIN_SORT" => "500", "SORT" => 10, "HINT" => array("TITLE" => GetMessage("top_panel_comp_tooltip_title"), "TEXT" => GetMessage('top_panel_comp_tooltip_empty'))));
         } else {
             $APPLICATION->AddPanelButton(array("ID" => "components", "ICON" => "bx-panel-components-icon", "TEXT" => GetMessage("top_panel_comp"), "MAIN_SORT" => "500", "SORT" => 10, "HINT" => array("TITLE" => GetMessage("top_panel_comp_tooltip_title"), "TEXT" => GetMessage("top_panel_comp_tooltip"))));
         }
     }
     //TEMPLATE button and submenu
     if ($USER->CanDoOperation("edit_php") || $USER->CanDoOperation("lpa_template_edit")) {
         $arMenu = array();
         $bUseSubmenu = false;
         $defaultUrl = '';
         if ($USER->CanDoOperation("edit_php")) {
             $filePath = SITE_TEMPLATE_PATH . "/styles.css";
             if (file_exists($_SERVER['DOCUMENT_ROOT'] . $filePath)) {
                 $arMenu[] = array("TEXT" => GetMessage("top_panel_templ_site_css"), "TITLE" => GetMessage("top_panel_templ_site_css_title"), "ICON" => "panel-edit-text", "HK_ID" => "top_panel_templ_site_css", "ACTION" => $APPLICATION->GetPopupLink(array("URL" => "/bitrix/admin/public_file_edit_src.php?lang=" . LANGUAGE_ID . "&path=" . urlencode($filePath) . "&site=" . SITE_ID . "&back_url=" . $encRequestUri, "PARAMS" => array("width" => 770, 'height' => 470, 'resize' => true, 'dialog_type' => 'EDITOR', "min_width" => 700, "min_height" => 400))));
开发者ID:Satariall,项目名称:izurit,代码行数:67,代码来源:top_panel.php


示例17: cleanCacheTreeBitrixDisk

 /**
  * Cleans cache with folders tree.
  *
  * @internal
  * @deprecated
  * @param array $storageIds List of storage id.
  * @return void
  */
 public function cleanCacheTreeBitrixDisk(array $storageIds)
 {
     $cache = Cache::createInstance();
     foreach ($storageIds as $id) {
         $cache->clean('storage_tr_' . $id, 'disk');
     }
     unset($id);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:16,代码来源:driver.php


示例18: startCache

	/**
	 * Function perform start of cache process, if needed
	 * @param mixed[]|string $cacheId An optional addition for cache key
	 * @return boolean True, if cache content needs to be generated, false if cache is valid and can be read
	 */
	final protected function startCache($cacheId = array())
	{
		if(!$this->getCacheNeed())
			return true;

		$this->currentCache = Data\Cache::createInstance();

		return $this->currentCache->startDataCache(intval($this->arParams['CACHE_TIME']), $this->getCacheKey($cacheId), static::COMPONENT_CACHE_DIR);
	}
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:14,代码来源:class.php


示例19: EndDataCache

 function EndDataCache()
 {
     if (!$this->bStarted) {
         return;
     }
     $this->bStarted = false;
     $arAllVars = ob_get_contents();
     $this->_cache->write($arAllVars, $this->basedir, $this->initdir, $this->filename, $this->TTL);
     if (\Bitrix\Main\Data\Cache::getShowCacheStat()) {
         $written = 0;
         $path = '';
         if ($this->_cache instanceof \Bitrix\Main\Data\ICacheEngineStat) {
             $written = $this->_cache->getWrittenBytes();
             $path = $this->_cache->getCachePath();
         } elseif ($this->_cache instanceof \ICacheBackend) {
             /** @noinspection PhpUndefinedFieldInspection */
             $written = $this->_cache->written;
             /** @noinspection PhpUndefinedFieldInspection */
             $path = $this->_cache->path;
         }
         \Bitrix\Main\Diag\CacheTracker::addCacheStatBytes($written);
         \Bitrix\Main\Diag\CacheTracker::add($written, $path, $this->basedir, $this->initdir, $this->filename, "W");
     }
     if (strlen($arAllVars) > 0) {
         ob_end_flush();
     } else {
         ob_end_clean();
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:29,代码来源:cache.php


示例20: Stop

 public function Stop($rel_path = "", $path = "", $cache_type = "")
 {
     /** @global CMain $APPLICATION */
     global $APPLICATION;
     /** @global CDatabase $DB */
     global $DB;
     /** @global int $CACHE_STAT_BYTES */
     global $CACHE_STAT_BYTES;
     if ($this->is_comp) {
         self::$level--;
     }
     $this->arResult = array("PATH" => $path, "REL_PATH" => $rel_path, "QUERY_COUNT" => 0, "QUERY_TIME" => 0, "QUERIES" => array(), "TIME" => getmicrotime() - $this->start_time, "BX_STATE" => $GLOBALS["BX_STATE"], "CACHE_TYPE" => $cache_type, "CACHE_SIZE" => \Bitrix\Main\Data\Cache::getShowCacheStat() ? \Bitrix\Main\Diag\CacheTracker::getCacheStatBytes() : 0, "LEVEL" => self:: 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Entity\Query类代码示例发布时间:2022-05-23
下一篇:
PHP Config\Option类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap