예제 #1
0
 /**
  * {@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>');
     }
 }
예제 #2
0
 /**
  * Flushes all bitrix cache.
  *
  * @return void
  */
 public static function flushAll()
 {
     $GLOBALS["CACHE_MANAGER"]->cleanAll();
     $GLOBALS["stackCacheManager"]->cleanAll();
     $staticHtmlCache = StaticHtmlCache::getInstance();
     $staticHtmlCache->deleteAll();
     BXClearCache(true);
 }
예제 #3
0
        if ($arParams["HIDE_EDIT_FORM"] != "Y" && IntVal($arResult["MICROBLOG_USER_ID"]) > 0 && $USER->IsAuthorized()) {
            ?>
<div id="sonet_log_microblog_container"><?php 
            $arBlogComponentParams = array("ID" => "new", "PATH_TO_BLOG" => $APPLICATION->GetCurPageParam("", array("WFILES")), "PATH_TO_POST" => $arParams["PATH_TO_USER_MICROBLOG_POST"], "PATH_TO_GROUP_POST" => $arParams["PATH_TO_GROUP_MICROBLOG_POST"], "PATH_TO_POST_EDIT" => $arParams["PATH_TO_USER_BLOG_POST_EDIT"], "PATH_TO_SMILE" => $arParams["PATH_TO_BLOG_SMILE"], "SET_TITLE" => "N", "GROUP_ID" => $arParams["BLOG_GROUP_ID"], "USER_ID" => $USER->GetID(), "SET_NAV_CHAIN" => "N", "USE_SOCNET" => "Y", "MICROBLOG" => "Y", "USE_CUT" => $arParams["BLOG_USE_CUT"], "NAME_TEMPLATE" => $arParams["NAME_TEMPLATE"], "CHECK_PERMISSIONS_DEST" => $arParams["CHECK_PERMISSIONS_DEST"], "TOP_TABS_VISIBLE" => array_key_exists("TOP_TABS_VISIBLE", $arParams) ? $arParams["TOP_TABS_VISIBLE"] : "Y");
            if ($arParams["ENTITY_TYPE"] == SONET_ENTITY_GROUP) {
                $arBlogComponentParams["SOCNET_GROUP_ID"] = $arParams["GROUP_ID"];
            } elseif ($arParams["ENTITY_TYPE"] != SONET_ENTITY_GROUP && $USER->GetID() != $arParams["CURRENT_USER_ID"]) {
                $arBlogComponentParams["SOCNET_USER_ID"] = $arParams["CURRENT_USER_ID"];
            }
            if (isset($arParams["DISPLAY"])) {
                $arBlogComponentParams["DISPLAY"] = $arParams["DISPLAY"];
            }
            if (defined("BITRIX24_INDEX_COMPOSITE")) {
                $arBlogComponentParams["POST_FORM_ACTION_URI"] = "/";
            }
            $staticHtmlCache = \Bitrix\Main\Data\StaticHtmlCache::getInstance();
            $staticHtmlCache->disableVoting();
            $APPLICATION->IncludeComponent("bitrix:socialnetwork.blog.post.edit", "", $arBlogComponentParams, $component, array("HIDE_ICONS" => "Y"));
            $staticHtmlCache->enableVoting();
            ?>
</div><?php 
        } elseif ($arParams["SHOW_EVENT_ID_FILTER"] == "Y") {
            ?>
<div class="feed-filter-fake-cont"></div><?php 
        }
        if ($arParams["SHOW_EVENT_ID_FILTER"] == "Y") {
            if ($arParams["IS_CRM"] == "Y") {
                $liveFeedFilter = new CCrmLiveFeedFilter(array('GridFormID' => '', 'EntityTypeID' => false));
                AddEventHandler('socialnetwork', 'OnBeforeSonetLogFilterFill', array($liveFeedFilter, 'OnBeforeSonetLogFilterFill'));
            }
            $GLOBALS["APPLICATION"]->IncludeComponent("bitrix:socialnetwork.log.filter", isset($arParams["FILTER_TEMPLATE"]) ? $arParams["FILTER_TEMPLATE"] : ".default", array("arParams" => array_merge($arParams, array("TOP_OUT" => "Y", "USE_TARGET" => !isset($arParams["USE_FILTER_TARGET"]) || $arParams["USE_FILTER_TARGET"] != "N" ? "Y" : "N", "TARGET_ID" => isset($_REQUEST["SONET_FILTER_MODE"]) && $_REQUEST["SONET_FILTER_MODE"] == "AJAX" ? "" : "sonet_blog_form", "USE_SONET_GROUPS" => !isset($arParams["IS_CRM"]) || $arParams["IS_CRM"] != "Y" ? "Y" : "N", "SHOW_FOLLOW" => isset($arParams["SHOW_FOLLOW_FILTER"]) && $arParams["SHOW_FOLLOW_FILTER"] == "N" ? "N" : "Y", "USE_SMART_FILTER" => isset($arResult["USE_SMART_FILTER"]) && $arResult["USE_SMART_FILTER"] == "Y" ? "Y" : "N", "MY_GROUPS_ONLY" => isset($arResult["MY_GROUPS_ONLY"]) && $arResult["MY_GROUPS_ONLY"] == "Y" ? "Y" : "N")), "arResult" => $arResult), null, array("HIDE_ICONS" => "Y"));
예제 #4
0
파일: frame.php 프로젝트: rasuldev/torino
 /**
  * * There are two variants of content's modification in this method.
  * The first one:
  * If it's ajax-hit the content will be replaced by json data with dynamic blocks,
  * javascript files and etc. - dynamic part
  *
  * The second one:
  * If it's simple hit the content will be modified also,
  * all dynamic blocks will be cutted out of the content - static part.
  *
  * @param string $content Html page content.
  *
  * @return string
  */
 public function processPageContent($content)
 {
     global $APPLICATION;
     $dividedData = $this->getDividedPageData($content);
     $htmlCacheChanged = false;
     if (self::getUseHTMLCache()) {
         $isLicenseExpired = self::isLicenseExpired();
         $staticHTMLCache = StaticHtmlCache::getInstance();
         if ($staticHTMLCache->isCacheable()) {
             $cacheExists = $staticHTMLCache->exists();
             if ((!$cacheExists || $staticHTMLCache->getMd5() !== $dividedData["md5"]) && !\CHTMLPagesCache::isIE9()) {
                 if ($cacheExists) {
                     $staticHTMLCache->delete();
                 }
                 if (!$isLicenseExpired) {
                     $success = $staticHTMLCache->write($dividedData["static"], $dividedData["md5"]);
                     if ($success) {
                         $htmlCacheChanged = true;
                         $staticHTMLCache->setUserPrivateKey();
                     }
                 }
             } else {
                 if ($isLicenseExpired) {
                     $staticHTMLCache->delete();
                 }
             }
             $dividedData["static"] = $this->replaceInjections($content);
         } else {
             $staticHTMLCache->delete();
             return $this->getAjaxError("not_cacheable");
         }
     }
     if (self::getUseAppCache() == true) {
         AppCacheManifest::getInstance()->generate($dividedData["static"]);
     } else {
         AppCacheManifest::checkObsoleteManifest();
     }
     if (self::isAjaxRequest()) {
         self::sendRandHeader();
         header("Content-Type: application/x-javascript; charset=" . SITE_CHARSET);
         header("X-Bitrix-Composite: Ajax " . ($htmlCacheChanged ? "(changed)" : "(stable)"));
         $content = array("js" => $APPLICATION->arHeadScripts, "additional_js" => $APPLICATION->arAdditionalJS, "lang" => \CJSCore::GetCoreMessages(), "css" => $APPLICATION->GetCSSArray(), "htmlCacheChanged" => $htmlCacheChanged, "isManifestUpdated" => AppCacheManifest::getInstance()->getIsModified(), "dynamicBlocks" => $dividedData["dynamic"], "spread" => array_map(array("CUtil", "JSEscape"), $APPLICATION->GetSpreadCookieUrls()));
         $content = \CUtil::PhpToJSObject($content);
     } else {
         $content = $dividedData["static"];
     }
     return $content;
 }
예제 #5
0
	public static function setCC()
	{
		global $APPLICATION;
		$APPLICATION->set_cookie("CC", "Y");
		$APPLICATION->set_cookie("NCC", "", 0);

		$staticHTMLCache = \Bitrix\Main\Data\StaticHtmlCache::getInstance();
		$staticHTMLCache->setUserPrivateKey();
	}
예제 #6
0
 /**
  * Function executes the component. Returns the result of it's execution.
  *
  * <p>Note: component must be inited by initComponent method.</p>
  * @param string $componentTemplate
  * @param array[string]mixed $arParams
  * @param CBitrixComponent $parentComponent
  * @return mixed
  *
  */
 public final function includeComponent($componentTemplate, $arParams, $parentComponent)
 {
     if (!$this->__bInited) {
         return null;
     }
     if ($componentTemplate !== false) {
         $this->setTemplateName($componentTemplate);
     }
     if (is_object($parentComponent) && $parentComponent instanceof cbitrixcomponent) {
         $this->__parent = $parentComponent;
     }
     if ($arParams["CACHE_TYPE"] != "Y" && $arParams["CACHE_TYPE"] != "N") {
         $arParams["CACHE_TYPE"] = "A";
     }
     if ($this->classOfComponent) {
         /** @var CBitrixComponent $component  */
         $component = new $this->classOfComponent($this);
         $component->arParams = $component->onPrepareComponentParams($arParams);
         $component->__prepareComponentParams($component->arParams);
         $component->onIncludeComponentLang();
         $result = $component->executeComponent();
         $this->__arIncludeAreaIcons = $component->__arIncludeAreaIcons;
         $frameMode = $component->frameMode;
     } else {
         $this->__prepareComponentParams($arParams);
         $this->arParams = $arParams;
         $this->includeComponentLang();
         $result = $this->__IncludeComponent();
         $frameMode = $this->frameMode;
     }
     if (!$frameMode) {
         $staticHtmlCache = \Bitrix\Main\Data\StaticHtmlCache::getInstance();
         $staticHtmlCache->markNonCacheable();
         if (defined("BX_COMPOSITE_DEBUG") && defined("USE_HTML_STATIC_CACHE") && USE_HTML_STATIC_CACHE == true) {
             AddMessage2Log("Component: " . $this->__name . "\n" . "Request URI: " . $_SERVER["REQUEST_URI"] . "\n" . "Script: " . (isset($_SERVER["REAL_FILE_PATH"]) ? $_SERVER["REAL_FILE_PATH"] : $_SERVER["SCRIPT_NAME"]), "composite");
         }
     }
     return $result;
 }
예제 #7
0
파일: frame.php 프로젝트: spas-viktor/books
 /**
  * OnEndBufferContent handler
  * There are two variants of content's modification in this method.
  * The first one:
  * If it's ajax-hit the content will be replaced by json data with dynamic blocks,
  * javascript files and etc. - dynamic part
  *
  * The second one:
  * If it's simple hit the content will be modified also,
  * all dynamic blocks will be cutted out of the content - static part.
  *
  * @param $content
  */
 public function onEndBufferContent(&$content)
 {
     global $APPLICATION;
     $dividedData = self::getInstance()->getDividedPageData($content);
     $htmlCacheChanged = false;
     if (self::getUseHTMLCache()) {
         $staticHTMLCache = \Bitrix\Main\Data\StaticHtmlCache::getInstance();
         if ($staticHTMLCache->isCacheable()) {
             if (!$staticHTMLCache->isExists() || $staticHTMLCache->getSubstring(-35, 32) !== $dividedData["md5"]) {
                 $staticHTMLCache->delete();
                 $staticHTMLCache->write($dividedData["static"] . "<!--" . $dividedData["md5"] . "-->");
             }
             $frame = self::getInstance();
             $ids = $frame->getDynamicIDs();
             foreach ($ids as $i => $id) {
                 if (isset($frame->containers[$id])) {
                     unset($ids[$i]);
                 }
             }
             $dividedData["static"] = preg_replace(array('/<!--\'start_frame_cache_(' . implode("|", $ids) . ')\'-->/', '/<!--\'end_frame_cache_(' . implode("|", $ids) . ')\'-->/'), array('<div id="bxdynamic_\\1">', '</div>'), $content);
             if ($frame->injectedJS) {
                 if (isset($frame->injectedJS["start"])) {
                     $dividedData["static"] = str_replace($frame->injectedJS["start"], "", $dividedData["static"]);
                 }
             }
         } elseif (!$staticHTMLCache->isCacheable()) {
             $staticHTMLCache->delete();
             return;
         }
     }
     if (self::getUseAppCache() == true) {
         \Bitrix\Main\Data\AppCacheManifest::getInstance()->generate($dividedData["static"]);
     } else {
         \Bitrix\Main\Data\AppCacheManifest::checkObsoleteManifest();
     }
     if (self::isAjaxRequest()) {
         header("Content-Type: application/x-javascript; charset=" . SITE_CHARSET);
         $content = array("js" => $APPLICATION->arHeadScripts, "additional_js" => $APPLICATION->arAdditionalJS, "lang" => \CJSCore::GetCoreMessages(), "css" => $APPLICATION->GetCSSArray(), "htmlCacheChanged" => $htmlCacheChanged, "isManifestUpdated" => \Bitrix\Main\Data\AppCacheManifest::getInstance()->getIsModified(), "dynamicBlocks" => $dividedData["dynamic"], "spread" => array_map(array("CUtil", "JSEscape"), $APPLICATION->GetSpreadCookieUrls()));
         $content = \CUtil::PhpToJSObject($content);
     } else {
         $content = $dividedData["static"];
     }
 }
예제 #8
0
파일: frame.php 프로젝트: Satariall/izurit
 public static function onBeforeLocalRedirect(&$url, $skip_security_check, $isExternal)
 {
     global $APPLICATION;
     if (!self::isAjaxRequest() || $isExternal && $skip_security_check !== true) {
         return;
     }
     $response = array("error" => true, "reason" => "redirect", "redirect_url" => $url);
     self::setEnable(false);
     if ($APPLICATION->buffered) {
         $APPLICATION->RestartBuffer();
     }
     self::getInstance()->isRedirect = true;
     StaticHtmlCache::getInstance()->delete();
     header("X-Bitrix-Composite: Ajax (error:redirect)");
     self::sendRandHeader();
     echo \CUtil::PhpToJSObject($response);
     die;
 }
예제 #9
0
 function __IncludePHPTemplate(&$arResult, &$arParams, $parentTemplateFolder = "")
 {
     /** @noinspection PhpUnusedLocalVariableInspection */
     global $APPLICATION, $USER, $DB;
     if (!$this->__bInited) {
         return false;
     }
     // these vars are used in the template file
     /** @noinspection PhpUnusedLocalVariableInspection */
     $templateName = $this->__name;
     /** @noinspection PhpUnusedLocalVariableInspection */
     $templateFile = $this->__file;
     /** @noinspection PhpUnusedLocalVariableInspection */
     $templateFolder = $this->__folder;
     /** @noinspection PhpUnusedLocalVariableInspection */
     $componentPath = $this->__component->GetPath();
     $component =& $this->__component;
     if ($this->__fileAlt != '') {
         include $_SERVER["DOCUMENT_ROOT"] . $this->__fileAlt;
         return null;
     }
     $templateData = false;
     include $_SERVER["DOCUMENT_ROOT"] . $this->__file;
     /** @var \Bitrix\Main\Page\FrameHelper $frame */
     foreach ($this->frames as $frame) {
         if ($frame->isStarted() && !$frame->isEnded()) {
             $frame->end();
         }
     }
     if (!$this->frameMode) {
         $staticHtmlCache = \Bitrix\Main\Data\StaticHtmlCache::getInstance();
         $staticHtmlCache->markNonCacheable();
         if (defined("BX_COMPOSITE_DEBUG") && defined("USE_HTML_STATIC_CACHE") && USE_HTML_STATIC_CACHE == true) {
             AddMessage2Log("Template: " . $this->__file . "\n" . "Request URI: " . $_SERVER["REQUEST_URI"] . "\n" . "Script: " . (isset($_SERVER["REAL_FILE_PATH"]) ? $_SERVER["REAL_FILE_PATH"] : $_SERVER["SCRIPT_NAME"]), "composite");
         }
     }
     $component_epilog = $this->__folder . "/component_epilog.php";
     if (file_exists($_SERVER["DOCUMENT_ROOT"] . $component_epilog)) {
         //These will be available with extract then component will
         //execute epilog without template
         $component->SetTemplateEpilog(array("epilogFile" => $component_epilog, "templateName" => $this->__name, "templateFile" => $this->__file, "templateFolder" => $this->__folder, "templateData" => $templateData));
     }
     return null;
 }