Beispiel #1
0
 /**
  * @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;
 }
	private static function onEpilogComposite()
	{
		global $USER, $APPLICATION;

		if (is_object($USER) && $USER->IsAuthorized())
		{
			if (self::isCurrentUserCC())
			{
				if ($APPLICATION->get_cookie("CC") !== "Y" || $APPLICATION->get_cookie("NCC") === "Y")
				{
					self::setCC();
				}
			}
			else
			{
				if ($APPLICATION->get_cookie("NCC") !== "Y" || $APPLICATION->get_cookie("CC") === "Y")
				{
					self::setNCC();
				}
			}
		}
		else
		{
			if ($APPLICATION->get_cookie("NCC") === "Y" || $APPLICATION->get_cookie("CC") === "Y")
			{
				self::deleteCompositeCookies();
			}
		}

		if (Main\Data\Cache::shouldClearCache())
		{
			$server = Main\Context::getCurrent()->getServer();

			$queryString = DeleteParam(array("clear_cache", "clear_cache_session"));
			$uri = new Bitrix\Main\Web\Uri($server->getRequestUri());
			$refinedUri = $queryString != "" ? $uri->getPath()."?".$queryString : $uri->getPath();

			$cachedFile = self::convertUriToPath($refinedUri, self::getHttpHost());

			$cacheStorage = Bitrix\Main\Data\StaticHtmlCache::getStaticHtmlStorage($cachedFile);
			if ($cacheStorage !== null)
			{
				$bytes = $cacheStorage->delete();
				if ($bytes !== false && $cacheStorage->shouldCountQuota())
				{
					self::updateQuota(-$bytes);
				}
			}
		}
	}