本文整理匯總了PHP中BXClearCache函數的典型用法代碼示例。如果您正苦於以下問題:PHP BXClearCache函數的具體用法?PHP BXClearCache怎麽用?PHP BXClearCache使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了BXClearCache函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: CallBack_AddComment
public static function CallBack_AddComment($arFields)
{
if (!CModule::IncludeModule('blog')) {
return false;
}
$arResult = array();
$arLog = CSocNetLog::GetList(array("ID" => "DESC"), array("TMP_ID" => $arFields["LOG_ID"]), false, false, array("ID", "SOURCE_ID", "SITE_ID", "RATING_ENTITY_ID"))->Fetch();
if ($arLog) {
$arIdeaPost = CBlogPost::GetById($arLog["SOURCE_ID"]);
if ($arIdeaPost) {
$UserIP = CBlogUser::GetUserIP();
$IdeaCommentId = CBlogComment::Add(array("BLOG_ID" => $arIdeaPost["BLOG_ID"], "POST_ID" => $arIdeaPost["ID"], "AUTHOR_ID" => $arFields["USER_ID"], "POST_TEXT" => $arFields["MESSAGE"], "DATE_CREATE" => ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL"), "PARENT_ID" => false, "AUTHOR_IP" => $UserIP[0], "AUTHOR_IP1" => $UserIP[1]));
$arResult = array("SOURCE_ID" => $IdeaCommentId);
if ($arLog["RATING_ENTITY_ID"] > 0) {
$arResult["RATING_TYPE_ID"] = "BLOG_COMMENT";
$arResult["RATING_ENTITY_ID"] = $IdeaCommentId;
}
if (intval($IdeaCommentId) == 0) {
global $APPLICATION;
if ($ex = $APPLICATION->GetException()) {
$arResult["ERROR"] = $ex->GetString();
}
} else {
//clear cache on succcess
BXClearCache(True, "/" . SITE_ID . "/idea/" . $arIdeaPost["BLOG_ID"] . "/first_page/");
BXClearCache(True, "/" . SITE_ID . "/idea/" . $arIdeaPost["BLOG_ID"] . "/pages/");
BXClearCache(True, "/" . SITE_ID . "/idea/" . $arIdeaPost["BLOG_ID"] . "/comment/" . $arIdeaPost["ID"] . "/");
BXClearCache(True, "/" . SITE_ID . "/idea/" . $arIdeaPost["BLOG_ID"] . "/post/" . $arIdeaPost["ID"] . "/");
}
}
}
return $arResult;
}
示例2: addComment
public function addComment($authorId, array $data)
{
$this->loadBlogPostData();
$commentFields = array("POST_ID" => $this->entityId, "BLOG_ID" => $this->blogPostData['BLOG_ID'], "POST_TEXT" => $data['text'], "DATE_CREATE" => new DateTime(), "PARENT_ID" => false, "AUTHOR_ID" => $authorId, "HAS_PROPS" => 'Y');
if (!empty($data['fileId'])) {
$commentFields['UF_BLOG_COMMENT_FILE'] = array($data['fileId']);
} elseif (!empty($data['versionId'])) {
$commentFields['UF_BLOG_COMMENT_FH'] = $data['versionId'];
}
$comId = \CBlogComment::add($commentFields);
if (!$comId) {
return;
}
if (method_exists("CBlogComment", "addLiveComment")) {
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
\CBlogComment::addLiveComment($comId, array("MODE" => "PULL_MESSAGE"));
}
BXClearCache(true, "/blog/comment/" . $this->entityId . "/");
if (!Loader::includeModule('socialnetwork')) {
return;
}
$query = \CSocNetLog::getList(array("ID" => "DESC"), array("EVENT_ID" => array("blog_post", "blog_post_important"), "SOURCE_ID" => $this->entityId), false, false, array("ID", "TMP_ID"));
$row = $query->fetch();
if (!$row) {
return;
}
$fieldsForSocnet = array("ENTITY_TYPE" => SONET_ENTITY_USER, "ENTITY_ID" => $this->blogPostData["AUTHOR_ID"], "EVENT_ID" => "blog_comment", "=LOG_DATE" => Application::getInstance()->getConnection()->getSqlHelper()->getCurrentDateTimeFunction(), "MESSAGE" => "file", "TEXT_MESSAGE" => "file", "URL" => "", "MODULE_ID" => false, "SOURCE_ID" => $comId, "LOG_ID" => $row["ID"], "RATING_TYPE_ID" => "BLOG_COMMENT", "RATING_ENTITY_ID" => $comId, "USER_ID" => $authorId);
\CSocNetLogComments::add($fieldsForSocnet, false, false, false);
}
示例3: Init
public static function Init()
{
static::$obCache = new \CPHPCache();
if (!empty($_GET['clear_cache'])) {
BXClearCache('/BXHelper/');
}
}
示例4: Update
public static function Update($ID, $arFields)
{
global $DB, $CACHE_MANAGER;
$ID = IntVal($ID);
if ($ID <= 0) {
return False;
}
if (!CBlogSmile::CheckFields("UPDATE", $arFields)) {
return false;
}
$strUpdate = $DB->PrepareUpdate("b_blog_smile", $arFields);
$strSql = "UPDATE b_blog_smile SET " . $strUpdate . " WHERE ID = " . $ID;
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if (is_set($arFields, "LANG")) {
$DB->Query("DELETE FROM b_blog_smile_lang WHERE SMILE_ID = " . $ID . "");
for ($i = 0; $i < count($arFields["LANG"]); $i++) {
$arInsert = $DB->PrepareInsert("b_blog_smile_lang", $arFields["LANG"][$i]);
$strSql = "INSERT INTO b_blog_smile_lang(SMILE_ID, " . $arInsert[0] . ") " . "VALUES(" . $ID . ", " . $arInsert[1] . ")";
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
}
}
$CACHE_MANAGER->Clean("b_blog_smile");
BXClearCache(true, "/blog/smiles/");
return $ID;
}
示例5: flushAll
/**
* Flushes all bitrix cache.
*
* @return void
*/
public static function flushAll()
{
$GLOBALS["CACHE_MANAGER"]->cleanAll();
$GLOBALS["stackCacheManager"]->cleanAll();
$staticHtmlCache = StaticHtmlCache::getInstance();
$staticHtmlCache->deleteAll();
BXClearCache(true);
}
示例6: Delete
function Delete($ID)
{
global $DB, $CACHE_MANAGER;
$ID = IntVal($ID);
$DB->Query("UPDATE b_blog_comment SET ICON_ID = NULL WHERE ICON_ID = " . $ID, True);
$DB->Query("DELETE FROM b_blog_smile_lang WHERE SMILE_ID = " . $ID, True);
$DB->Query("DELETE FROM b_blog_smile WHERE ID = " . $ID, True);
$CACHE_MANAGER->Clean("b_blog_smile");
BXClearCache(true, "/blog/smiles/");
return true;
}
示例7: __construct
public function __construct($arParams)
{
$this->SITE_ID = $arParams["SITE_ID"];
$this->REWRITE = $arParams["REWRITE"];
$this->ModuleBlogGroup = '[' . $this->SITE_ID . '] ' . GetMessage("IDEA_BLOG_GROUP_NAME");
$this->ModuleBlogUrl .= "_" . $this->SITE_ID;
//NULL CACHE
BXClearCache(True, '/' . $this->SITE_ID . '/idea/');
BXClearCache(True, '/' . SITE_ID . '/idea/');
global $CACHE_MANAGER;
if (CACHED_b_user_field_enum !== false) {
$CACHE_MANAGER->CleanDir("b_user_field_enum");
}
//Statuses List (for demo)
$this->arResult["SETTINGS"]["STATUS"] = CIdeaManagment::getInstance()->Idea()->GetStatusList();
foreach ($this->arResult["SETTINGS"]["STATUS"] as $arStatus) {
$this->arResult["SETTINGS"]["STATUS_ID"][$arStatus["XML_ID"]] = $arStatus["ID"];
}
//Lang List
$l = CLanguage::GetList($by = "sort", $order = "asc");
while ($r = $l->Fetch()) {
$this->arResult["SETTINGS"]["LANG"][] = $r;
}
//Sites List
$oSites = CSite::GetList($b = "", $o = "", array("ACTIVE" => "Y"));
while ($site = $oSites->Fetch()) {
$this->arResult["SETTINGS"]["SITE"][$site["LID"]] = array("LANGUAGE_ID" => $site["LANGUAGE_ID"], "ABS_DOC_ROOT" => $site["ABS_DOC_ROOT"], "DIR" => $site["DIR"], "SITE_ID" => $site["LID"], "SERVER_NAME" => $site["SERVER_NAME"], "NAME" => $site["NAME"]);
}
if (array_key_exists($this->SITE_ID, $this->arResult["SETTINGS"]["SITE"])) {
$this->PublicDir = str_replace(array("#SITE_DIR#"), array($this->arResult["SETTINGS"]["SITE"][$this->SITE_ID]["DIR"]), $this->PublicDir);
}
$site = CFileMan::__CheckSite($this->SITE_ID);
$this->DOCUMENT_ROOT = CSite::GetSiteDocRoot($site);
$this->IO = CBXVirtualIo::GetInstance();
//SetDefault
$this->arResult["INSTALLATION"]["IBLOCK_TYPE_INSTALL"] = true;
$this->arResult["INSTALLATION"]["IBLOCK_INSTALL"] = true;
$this->arResult["INSTALLATION"]["BLOG_GROUP_INSTALL"] = true;
$this->arResult["INSTALLATION"]["BLOG_INSTALL"] = true;
$this->CheckParams();
}
示例8: BXClearCache
//$Notify->getEmailNotify()->Send();
//END -> Notifications
//start custom, use UF binding ::@Idea
if ($arResult["IDEA_MODERATOR"] && $_REQUEST["BIND_OFFICIAL_ANSWER"] == "Y") {
// Bind offical answer
CIdeaManagment::getInstance()->IdeaComment($commentID)->Bind();
}
if ($arResult["IDEA_MODERATOR"] && $_REQUEST["BIND_IDEA_STATUS"] != "") {
CIdeaManagment::getInstance()->Idea($arPost["ID"])->SetStatus($_REQUEST["BIND_IDEA_STATUS"]);
BXClearCache(True, '/' . SITE_ID . '/idea/statistic_list/');
}
/*end*/
BXClearCache(True, "/" . SITE_ID . "/idea/" . $arBlog["ID"] . "/comment/" . $arOldComment["POST_ID"] . "/");
BXClearCache(True, "/" . SITE_ID . "/idea/" . $arBlog["ID"] . "/post/" . $arOldComment["POST_ID"] . "/");
BXClearCache(True, "/" . SITE_ID . "/idea/" . $arBlog["ID"] . "/first_page/");
BXClearCache(True, "/" . SITE_ID . "/idea/" . $arBlog["ID"] . "/pages/");
$commentUrl = CComponentEngine::MakePathFromTemplate(htmlspecialcharsBack($arParams["PATH_TO_POST"]), array("blog" => $arBlog["URL"], "post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arParams["ALLOW_POST_CODE"]), "user_id" => $arBlog["OWNER_ID"], "group_id" => $arParams["SOCNET_GROUP_ID"]));
if (strpos($commentUrl, "?") !== false) {
$commentUrl .= "&";
} else {
$commentUrl .= "?";
}
if ($_REQUEST["redirect_type"] == 'list') {
//bx redirect for idea list
LocalRedirect($APPLICATION->GetCurPageParam());
} elseif (strlen($arFields["PUBLISH_STATUS"]) > 0 && $arFields["PUBLISH_STATUS"] != BLOG_PUBLISH_STATUS_PUBLISH) {
$commentAddedUrl = $commentUrl . $arParams["COMMENT_ID_VAR"] . "=" . $commentID . "&hidden_add_comment_id=" . $commentID;
LocalRedirect($commentAddedUrl);
} else {
$commentUrl .= $arParams["COMMENT_ID_VAR"] . "=" . $commentID . "#" . $commentID;
LocalRedirect($commentUrl);
示例9: OnAfterIndexAdd
function OnAfterIndexAdd($ID, $arFields)
{
if (isset($arFields["PARAMS"]) && is_array($arFields["PARAMS"]) && array_key_exists("socnet_group", $arFields["PARAMS"]))
{
$arSiteID = array_keys($arFields["SITE_ID"]);
foreach ($arSiteID as $siteID)
BXClearCache(true, "/".$siteID."/bitrix/search.tags.cloud/");
}
}
示例10: elseif
} else {
if (!$USER->CanDoOperation('cache_control') && !$USER->CanDoOperation('view_other_settings')) {
$APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
$errorMessage = "";
$okMessage = "";
if ($REQUEST_METHOD == "POST" && $clearcache == "Y" && strlen($cachetype) > 0 && check_bitrix_sessid() && $isAdmin) {
if ($cachetype == "menu") {
$GLOBALS["CACHE_MANAGER"]->CleanDir("menu");
} elseif ($cachetype == "managed") {
$GLOBALS["CACHE_MANAGER"]->CleanAll();
$GLOBALS["stackCacheManager"]->CleanAll();
} elseif ($cachetype == "html") {
CHTMLPagesCache::CleanAll();
} else {
BXClearCache($cachetype == "all");
$GLOBALS["CACHE_MANAGER"]->CleanAll();
$GLOBALS["stackCacheManager"]->CleanAll();
CHTMLPagesCache::CleanAll();
}
$okMessage .= GetMessage("MAIN_OPTION_CACHE_OK") . ". ";
}
if ($REQUEST_METHOD == "POST" && ($cache_on == "Y" || $cache_on == "N") && check_bitrix_sessid() && $isAdmin) {
if (COption::GetOptionString("main", "component_cache_on", "Y") == "Y") {
if ($cache_on == "N") {
COption::SetOptionString("main", "component_cache_on", "N");
$okMessage .= GetMessage("MAIN_OPTION_CACHE_SUCCESS") . ". ";
}
} else {
if ($cache_on == "Y") {
COption::SetOptionString("main", "component_cache_on", "Y");
示例11: explode
$sites = CSite::GetByID($_GET["site_id"]);
if(!($site = $sites->Fetch()))
die("Incorrect site_id.");
$aComponents = explode(",", $_GET["component_name"]);
foreach($aComponents as $component_name)
{
$componentRelativePath = CComponentEngine::MakeComponentPath($component_name);
if (strlen($componentRelativePath) > 0)
{
$arComponentDescription = CComponentUtil::GetComponentDescr($component_name);
if (isset($arComponentDescription) && is_array($arComponentDescription))
{
if (array_key_exists("CACHE_PATH", $arComponentDescription))
{
if($arComponentDescription["CACHE_PATH"] == "Y")
$arComponentDescription["CACHE_PATH"] = "/".$site["ID"].$componentRelativePath;
if(strlen($arComponentDescription["CACHE_PATH"]) > 0)
{
$obCache = new CPHPCache;
$obCache->CleanDir($arComponentDescription["CACHE_PATH"], "cache");
BXClearCache(true, $arComponentDescription["CACHE_PATH"]);
}
}
}
if(defined("BX_COMP_MANAGED_CACHE"))
$CACHE_MANAGER->ClearByTag($component_name);
}
}
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_admin_js.php");
?>
示例12: empty
if ($ID > 0) {
$arSmile = empty($arSmile) ? CForumSmile::GetByID($ID) : $arSmile;
CForumSmile::Update($ID, $arFields);
} else {
$ID = CForumSmile::Add($arFields);
}
if ($e = $GLOBALS["APPLICATION"]->GetException()) {
$arError[] = array("id" => "", "text" => $e->getString());
if (!empty($_FILES["IMAGE"]["tmp_name"]) && isset($sUploadDir)) {
@unlink($sUploadDir . $fileName);
unset($arFields["IMAGE"]);
}
} else {
BXClearCache(true, "/" . LANG . "/forum/smilesList/");
BXClearCache(true, "/" . LANG . "/forum/iconsList/");
BXClearCache(true, "/" . LANG . "/forum/smiles/");
if (!empty($arSmile)) {
$res = CForumSmile::GetByID($ID);
if ($arSmile["IMAGE"] != $res["IMAGE"]) {
@unlink($_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/images/forum/" . ($arSmile["TYPE"] == "I" ? "icon" : "smile") . "/" . $arSmile["IMAGE"]);
} elseif ($arSmile["TYPE"] != $res["TYPE"]) {
CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/images/forum/" . ($arSmile["TYPE"] == "I" ? "icon" : "smile") . "/" . $arSmile["IMAGE"], $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/images/forum/" . ($res["TYPE"] == "I" ? "icon" : "smile") . "/" . $arSmile["IMAGE"], false, false, true, "");
}
}
LocalRedirect(strlen($save) > 0 ? "forum_smile.php?lang=" . LANG . "&" . GetFilterParams("filter_", false) : "forum_smile_edit.php?lang=" . LANG . "&ID=" . $ID . "&" . GetFilterParams("filter_", false));
}
}
$e = new CAdminException($arError);
$message = new CAdminMessage($ID > 0 ? GetMessage("ERROR_EDIT_SMILE") : GetMessage("ERROR_ADD_SMILE"), $e);
$bInitVars = true;
}
示例13: BXClearCache
BXClearCache(true, "/bitrix/forum/user/" . $res["RECIPIENT_ID"] . "/");
$arComponentPath = array("bitrix:forum");
foreach ($arComponentPath as $path) {
$componentRelativePath = CComponentEngine::MakeComponentPath($path);
$arComponentDescription = CComponentUtil::GetComponentDescr($path);
if (strLen($componentRelativePath) <= 0 || !is_array($arComponentDescription)) {
continue;
} elseif (!array_key_exists("CACHE_PATH", $arComponentDescription)) {
continue;
}
$path = str_replace("//", "/", $componentRelativePath . "/user" . $res["RECIPIENT_ID"]);
if ($arComponentDescription["CACHE_PATH"] == "Y") {
$path = "/" . SITE_ID . $path;
}
if (!empty($path)) {
BXClearCache(true, $path);
}
}
}
}
if (empty($arError)) {
if ($action == "save") {
LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_PM_READ"], array("FID" => $arParams["FID"], "MID" => $arParams["MID"])));
} elseif ($action == "send") {
LocalRedirect(ForumAddPageParams(CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_PM_LIST"], array("FID" => "2")), array("result" => "sent")));
}
} else {
$e = new CAdminException(array_reverse($arError));
$GLOBALS["APPLICATION"]->ThrowException($e);
$err = $GLOBALS['APPLICATION']->GetException();
$arResult["ERROR_MESSAGE"] = $err->GetString();
示例14: array
if (!CForumGroup::CanUserAddGroup($USER->GetUserGroupArray())) {
$arError[] = array("code" => "not_right_for_add", "title" => GetMessage("ERROR_ADD_GROUP_NOT_RIGHT"));
} else {
$ID = CForumGroup::Add($arFields);
if (IntVal($ID) <= 0) {
$arError[] = array("code" => "not_add", "title" => GetMessage("ERROR_ADD_GROUP"));
}
}
}
}
if (!empty($arError) && ($e = $GLOBALS["APPLICATION"]->GetException())) {
$message = new CAdminMessage($ID > 0 ? GetMessage("ERROR_EDIT_GROUP") : GetMessage("ERROR_ADD_GROUP"), $e);
}
$bInitVars = !empty($arError) ? true : false;
if (strlen($save) > 0 && empty($arError)) {
BXClearCache(true, "bitrix/forum/group/");
LocalRedirect("forum_group.php?lang=" . LANG . "&" . GetFilterParams("filter_", false));
}
}
if ($ID > 0) {
$db_group = CForumGroup::GetList(array(), array("ID" => $ID));
$db_group->ExtractFields("str_", False);
}
if ($bInitVars) {
$DB->InitTableVarsForEdit("b_forum_group", "", "str_");
}
$sDocTitle = $ID > 0 ? str_replace("#ID#", $ID, GetMessage("FORUM_EDIT_RECORD")) : GetMessage("FORUM_NEW_RECORD");
$APPLICATION->SetTitle($sDocTitle);
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
/*********************************************************************/
/******************** BODY *****************************************/
示例15: SetSoNetFeaturePermIndexSearch
function SetSoNetFeaturePermIndexSearch($ID, $arFields)
{
$featurePerm = CSocNetFeaturesPerms::GetByID($ID);
if ($featurePerm["OPERATION_ID"] == "view_post") {
if (CModule::IncludeModule("socialnetwork")) {
$feature = CSocNetFeatures::GetByID($featurePerm["FEATURE_ID"]);
if ($feature["FEATURE"] == "blog" && IntVal($feature["ENTITY_ID"]) > 0) {
if ($feature["ACTIVE"] == "Y" && ($feature["ENTITY_TYPE"] == "U" && $arFields["ROLE"] == "A" || $feature["ENTITY_TYPE"] == "G" && $arFields["ROLE"] == "N")) {
$arFilter = array("USE_SOCNET" => "Y");
if ($feature["ENTITY_TYPE"] == "U") {
$arFilter["OWNER_ID"] = $feature["ENTITY_ID"];
} else {
$arFilter["SOCNET_GROUP_ID"] = $feature["ENTITY_ID"];
}
$dbBlog = CBlog::GetList(array(), $arFilter, false, array("nTopCount" => 1), array("ID", "SOCNET_GROUP_ID"));
if ($arBlog = $dbBlog->Fetch()) {
CBlog::AddSocnetRead($arBlog["ID"]);
}
} else {
$arFilter = array("USE_SOCNET" => "Y");
if ($feature["ENTITY_TYPE"] == "U") {
$arFilter["OWNER_ID"] = $feature["ENTITY_ID"];
} else {
$arFilter["SOCNET_GROUP_ID"] = $feature["ENTITY_ID"];
}
$dbBlog = CBlog::GetList(array(), $arFilter, false, array("nTopCount" => 1), array("ID", "SOCNET_GROUP_ID"));
if ($arBlog = $dbBlog->Fetch()) {
CBlog::DeleteSocnetRead($arBlog["ID"]);
}
}
if ($arBlog && intval($arBlog["SOCNET_GROUP_ID"]) > 0 && CModule::IncludeModule("socialnetwork") && method_exists("CSocNetGroup", "GetSite")) {
$arSites = array();
$rsGroupSite = CSocNetGroup::GetSite($arBlog["SOCNET_GROUP_ID"]);
while ($arGroupSite = $rsGroupSite->Fetch()) {
$arSites[] = $arGroupSite["LID"];
}
} else {
$arSites = array(SITE_ID);
}
foreach ($arSites as $site_id_tmp) {
BXClearCache(True, "/" . $site_id_tmp . "/blog/sonet/");
}
}
}
}
}