当前位置: 首页>>代码示例>>PHP>>正文


PHP CIBlock::clearIblockTagCache方法代码示例

本文整理汇总了PHP中CIBlock::clearIblockTagCache方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlock::clearIblockTagCache方法的具体用法?PHP CIBlock::clearIblockTagCache怎么用?PHP CIBlock::clearIblockTagCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CIBlock的用法示例。


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

示例1: Delete


//.........这里部分代码省略.........
                     return false;
                 }
             } else {
                 if (!$DB->Query("DELETE FROM b_iblock_element_property WHERE IBLOCK_ELEMENT_ID = " . $elementId)) {
                     return false;
                 }
             }
             static $arDelCache = array();
             if (!is_set($arDelCache, $zr["IBLOCK_ID"])) {
                 $arDelCache[$zr["IBLOCK_ID"]] = false;
                 $db_ps = $DB->Query("SELECT ID,IBLOCK_ID,VERSION,MULTIPLE FROM b_iblock_property WHERE PROPERTY_TYPE='E' AND (LINK_IBLOCK_ID=" . $zr["IBLOCK_ID"] . " OR LINK_IBLOCK_ID=0 OR LINK_IBLOCK_ID IS NULL)");
                 while ($ar_ps = $db_ps->Fetch()) {
                     if ($ar_ps["VERSION"] == 2) {
                         if ($ar_ps["MULTIPLE"] == "Y") {
                             $strTable = "b_iblock_element_prop_m" . $ar_ps["IBLOCK_ID"];
                         } else {
                             $strTable = "b_iblock_element_prop_s" . $ar_ps["IBLOCK_ID"];
                         }
                     } else {
                         $strTable = "b_iblock_element_property";
                     }
                     $arDelCache[$zr["IBLOCK_ID"]][$strTable][] = $ar_ps["ID"];
                 }
             }
             if ($arDelCache[$zr["IBLOCK_ID"]]) {
                 foreach ($arDelCache[$zr["IBLOCK_ID"]] as $strTable => $arProps) {
                     if (strncmp("b_iblock_element_prop_s", $strTable, 23) == 0) {
                         $tableFields = $DB->GetTableFields($strTable);
                         foreach ($arProps as $prop_id) {
                             $strSql = "UPDATE " . $strTable . " SET PROPERTY_" . $prop_id . "=null";
                             if (isset($tableFields["DESCRIPTION_" . $prop_id])) {
                                 $strSql .= ",DESCRIPTION_" . $prop_id . "=null";
                             }
                             $strSql .= " WHERE PROPERTY_" . $prop_id . "=" . $zr["ID"];
                             if (!$DB->Query($strSql)) {
                                 return false;
                             }
                         }
                     } elseif (strncmp("b_iblock_element_prop_m", $strTable, 23) == 0) {
                         $tableFields = $DB->GetTableFields(str_replace("prop_m", "prop_s", $strTable));
                         $strSql = "SELECT IBLOCK_PROPERTY_ID, IBLOCK_ELEMENT_ID FROM " . $strTable . " WHERE IBLOCK_PROPERTY_ID IN (" . implode(", ", $arProps) . ") AND VALUE_NUM=" . $zr["ID"];
                         $rs = $DB->Query($strSql);
                         while ($ar = $rs->Fetch()) {
                             $strSql = "\n\t\t\t\t\t\t\t\t\tUPDATE " . str_replace("prop_m", "prop_s", $strTable) . "\n\t\t\t\t\t\t\t\t\tSET PROPERTY_" . $ar["IBLOCK_PROPERTY_ID"] . "=null\n\t\t\t\t\t\t\t\t\t" . (isset($tableFields["DESCRIPTION_" . $ar["IBLOCK_PROPERTY_ID"]]) ? ",DESCRIPTION_" . $ar["IBLOCK_PROPERTY_ID"] . "=null" : "") . "\n\t\t\t\t\t\t\t\t\tWHERE IBLOCK_ELEMENT_ID = " . $ar["IBLOCK_ELEMENT_ID"] . "\n\t\t\t\t\t\t\t\t";
                             if (!$DB->Query($strSql)) {
                                 return false;
                             }
                         }
                         $strSql = "DELETE FROM " . $strTable . " WHERE IBLOCK_PROPERTY_ID IN (" . implode(", ", $arProps) . ") AND VALUE_NUM=" . $zr["ID"];
                         if (!$DB->Query($strSql)) {
                             return false;
                         }
                     } else {
                         $strSql = "DELETE FROM " . $strTable . " WHERE IBLOCK_PROPERTY_ID IN (" . implode(", ", $arProps) . ") AND VALUE_NUM=" . $zr["ID"];
                         if (!$DB->Query($strSql)) {
                             return false;
                         }
                     }
                 }
             }
             if (!$DB->Query("DELETE FROM b_iblock_section_element WHERE IBLOCK_ELEMENT_ID = " . $elementId)) {
                 return false;
             }
             $obIBlockElementRights = new CIBlockElementRights($zr["IBLOCK_ID"], $zr["ID"]);
             $obIBlockElementRights->DeleteAllRights();
             $ipropTemplates = new \Bitrix\Iblock\InheritedProperty\ElementTemplates($zr["IBLOCK_ID"], $zr["ID"]);
             $ipropTemplates->delete();
             if (IntVal($zr["WF_PARENT_ELEMENT_ID"]) <= 0 && $zr["WF_STATUS_ID"] == 1 && CModule::IncludeModule("search")) {
                 CSearch::DeleteIndex("iblock", $elementId);
             }
             CIBlockElement::DeleteFile($zr["PREVIEW_PICTURE"], $zr["ID"], "PREVIEW", $zr["WF_PARENT_ELEMENT_ID"], $zr["IBLOCK_ID"]);
             CIBlockElement::DeleteFile($zr["DETAIL_PICTURE"], $zr["ID"], "DETAIL", $zr["WF_PARENT_ELEMENT_ID"], $zr["IBLOCK_ID"]);
             if (CModule::IncludeModule("workflow")) {
                 $DB->Query("DELETE FROM b_workflow_move WHERE IBLOCK_ELEMENT_ID=" . $elementId);
             }
             $DB->Query("DELETE FROM b_iblock_element_lock WHERE IBLOCK_ELEMENT_ID=" . $elementId);
             $DB->Query("DELETE FROM b_rating_vote WHERE ENTITY_TYPE_ID = 'IBLOCK_ELEMENT' AND ENTITY_ID = " . $elementId);
             $DB->Query("DELETE FROM b_rating_voting WHERE ENTITY_TYPE_ID = 'IBLOCK_ELEMENT' AND ENTITY_ID = " . $elementId);
             if (!$DB->Query("DELETE FROM b_iblock_element WHERE ID=" . $elementId)) {
                 return false;
             }
             if (isset(self::$elementIblock[$elementId])) {
                 unset(self::$elementIblock[$elementId]);
             }
             \Bitrix\Iblock\PropertyIndex\Manager::deleteElementIndex($zr["IBLOCK_ID"], $piId);
             if (CModule::IncludeModule("bizproc")) {
                 CBPDocument::OnDocumentDelete(array("iblock", "CIBlockDocument", $zr["ID"]), $arErrorsTmp);
             }
             foreach (GetModuleEvents("iblock", "OnAfterIBlockElementDelete", true) as $arEvent) {
                 ExecuteModuleEventEx($arEvent, array($zr));
             }
             CIBlock::clearIblockTagCache($zr['IBLOCK_ID']);
             unset($elementId);
         }
     }
     /************* QUOTA *************/
     $_SESSION["SESS_RECOUNT_DB"] = "Y";
     /************* QUOTA *************/
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:iblockelement.php

示例2: array

    }
    // delete 'not-in-file' element prices
    if ($bAllLinesLoaded && $bIBlockIsCatalog && 'Y' == $bUpdatePrice && $outFileAction == "D") {
        $res = CPrice::GetList(array(), array("ELEMENT_IBLOCK_ID" => $IBLOCK_ID, "!TMP_ID" => $tmpid), false, false, array("ID"));
        while ($arr = $res->Fetch()) {
            CPrice::Delete($arr["ID"]);
            if (!($bAllLinesLoaded = CSVCheckTimeout($max_execution_time))) {
                break;
            }
        }
    }
    if (!$bAllLinesLoaded) {
        $bAllDataLoaded = false;
        $INTERNAL_VARS_LIST = "tmpid,line_num,correct_lines,error_lines,killed_lines,arIBlockProperty,bThereIsGroups,arProductGroups,arIBlockPropertyValue,bDeactivationStarted,bUpdatePrice";
        $SETUP_VARS_LIST = "IBLOCK_ID,URL_DATA_FILE,fields_type,first_names_r,delimiter_r,delimiter_other_r,first_names_f,metki_f,PATH2IMAGE_FILES,outFileAction,inFileAction,max_execution_time,IMAGE_RESIZE,USE_TRANSLIT,TRANSLIT_LANG,CLEAR_EMPTY_PRICE,CML2_LINK_IS_XML";
        for ($i = 0; $i < $NUM_FIELDS; $i++) {
            $SETUP_VARS_LIST .= ",field_" . $i;
        }
        $CUR_FILE_POS = $csvFile->GetPos();
    } else {
        CIBlock::enableClearTagCache();
        CIBlock::clearIblockTagCache($IBLOCK_ID);
    }
}
if ($bTmpUserCreated) {
    unset($USER);
    if (isset($USER_TMP)) {
        $USER = $USER_TMP;
        unset($USER_TMP);
    }
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:csv_new_run.php

示例3: clearPublicCache

 protected static function clearPublicCache($productID, $productInfo = array())
 {
     $productID = (int) $productID;
     if ($productID <= 0) {
         return;
     }
     $iblockID = (int) (isset($productInfo['IBLOCK_ID']) ? $productInfo['IBLOCK_ID'] : CIBlockElement::GetIBlockByID($productID));
     if ($iblockID <= 0) {
         return;
     }
     if (!isset(self::$clearAutoCache[$iblockID])) {
         CIBlock::clearIblockTagCache($iblockID);
         self::$clearAutoCache[$iblockID] = true;
     }
     $productInfo['ID'] = $productID;
     $productInfo['ELEMENT_IBLOCK_ID'] = $iblockID;
     $productInfo['IBLOCK_ID'] = $iblockID;
     if (isset($productInfo['CAN_BUY_ZERO'])) {
         $productInfo['NEGATIVE_AMOUNT_TRACE'] = $productInfo['CAN_BUY_ZERO'];
     }
     foreach (GetModuleEvents('catalog', 'OnProductQuantityTrace', true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($productID, $productInfo));
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:24,代码来源:product_provider.php

示例4: Update


//.........这里部分代码省略.........
                         }
                     }
                 }
             }
         } else {
             if (array_key_exists("PREVIEW_PICTURE", $arFields)) {
                 CFile::SaveForDB($arFields, "PREVIEW_PICTURE", "iblock");
             }
             if (array_key_exists("DETAIL_PICTURE", $arFields)) {
                 CFile::SaveForDB($arFields, "DETAIL_PICTURE", "iblock");
             }
         }
         $newFields = $arFields;
         $newFields["ID"] = $ID;
         $IBLOCK_SECTION_ID = $arFields["IBLOCK_SECTION_ID"];
         unset($arFields["IBLOCK_ID"], $arFields["WF_NEW"], $arFields["IBLOCK_SECTION_ID"]);
         $bTimeStampNA = false;
         if (is_set($arFields, "TIMESTAMP_X") && ($arFields["TIMESTAMP_X"] === NULL || $arFields["TIMESTAMP_X"] === false)) {
             $bTimeStampNA = true;
             unset($arFields["TIMESTAMP_X"]);
             unset($newFields["TIMESTAMP_X"]);
         }
         foreach (GetModuleEvents("iblock", "OnIBlockElementUpdate", true) as $arEvent) {
             ExecuteModuleEventEx($arEvent, array($newFields, $ar_wf_element));
         }
         unset($newFields);
         $strUpdate = $DB->PrepareUpdate("b_iblock_element", $arFields, "iblock");
         if (!empty($strUpdate)) {
             $strUpdate .= ", ";
         }
         $strSql = "UPDATE b_iblock_element SET " . $strUpdate . ($bTimeStampNA ? "TIMESTAMP_X=TIMESTAMP_X" : "TIMESTAMP_X=now()") . " WHERE ID=" . $ID;
         $DB->Query($strSql, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
         if (isset($arFields["PROPERTY_VALUES"]) && is_array($arFields["PROPERTY_VALUES"]) && !empty($arFields["PROPERTY_VALUES"])) {
             CIBlockElement::SetPropertyValues($ID, $ar_element["IBLOCK_ID"], $arFields["PROPERTY_VALUES"]);
         }
         if (is_set($arFields, "IBLOCK_SECTION")) {
             CIBlockElement::SetElementSection($ID, $arFields["IBLOCK_SECTION"], false, $arIBlock["RIGHTS_MODE"] === "E" ? $arIBlock["ID"] : 0, $IBLOCK_SECTION_ID);
         }
         if ($arIBlock["RIGHTS_MODE"] === "E") {
             $obElementRights = new CIBlockElementRights($arIBlock["ID"], $ID);
             if (array_key_exists("RIGHTS", $arFields) && is_array($arFields["RIGHTS"])) {
                 $obElementRights->SetRights($arFields["RIGHTS"]);
             }
         }
         if (array_key_exists("IPROPERTY_TEMPLATES", $arFields)) {
             $ipropTemplates = new \Bitrix\Iblock\InheritedProperty\ElementTemplates($arIBlock["ID"], $ID);
             $ipropTemplates->set($arFields["IPROPERTY_TEMPLATES"]);
         }
         if ($bUpdateSearch) {
             CIBlockElement::UpdateSearch($ID, true);
         }
         \Bitrix\Iblock\PropertyIndex\Manager::updateElementIndex($arIBlock["ID"], $ID);
         if ($bWorkFlow) {
             CIBlockElement::WF_CleanUpHistoryCopies($ID);
         }
         //Restore saved values
         if ($SAVED_PREVIEW_PICTURE !== false) {
             $arFields["PREVIEW_PICTURE_ID"] = $arFields["PREVIEW_PICTURE"];
             $arFields["PREVIEW_PICTURE"] = $SAVED_PREVIEW_PICTURE;
         } else {
             unset($arFields["PREVIEW_PICTURE"]);
         }
         if ($SAVED_DETAIL_PICTURE !== false) {
             $arFields["DETAIL_PICTURE_ID"] = $arFields["DETAIL_PICTURE"];
             $arFields["DETAIL_PICTURE"] = $SAVED_DETAIL_PICTURE;
         } else {
             unset($arFields["DETAIL_PICTURE"]);
         }
         if ($arIBlock["FIELDS"]["LOG_ELEMENT_EDIT"]["IS_REQUIRED"] == "Y") {
             $USER_ID = is_object($USER) ? intval($USER->GetID()) : 0;
             $arEvents = GetModuleEvents("main", "OnBeforeEventLog", true);
             if (empty($arEvents) || ExecuteModuleEventEx($arEvents[0], array($USER_ID)) === false) {
                 $rsElement = CIBlockElement::GetList(array(), array("=ID" => $ID, "CHECK_PERMISSIONS" => "N", "SHOW_NEW" => "Y"), false, false, array("ID", "NAME", "LIST_PAGE_URL", "CODE"));
                 $arElement = $rsElement->GetNext();
                 $res = array("ID" => $ID, "CODE" => $arElement["CODE"], "NAME" => $arElement["NAME"], "ELEMENT_NAME" => $arIBlock["ELEMENT_NAME"], "USER_ID" => $USER_ID, "IBLOCK_PAGE_URL" => $arElement["LIST_PAGE_URL"]);
                 CEventLog::Log("IBLOCK", "IBLOCK_ELEMENT_EDIT", "iblock", $arIBlock["ID"], serialize($res));
             }
         }
         $Result = true;
         /************* QUOTA *************/
         $_SESSION["SESS_RECOUNT_DB"] = "Y";
         /************* QUOTA *************/
     }
     $arFields["ID"] = $ID;
     $arFields["IBLOCK_ID"] = $ar_element["IBLOCK_ID"];
     $arFields["RESULT"] =& $Result;
     if (isset($arFields["PREVIEW_PICTURE"]) && $arFields["PREVIEW_PICTURE"]["COPY_FILE"] == "Y" && $arFields["PREVIEW_PICTURE"]["copy"]) {
         @unlink($arFields["PREVIEW_PICTURE"]["tmp_name"]);
         @rmdir(dirname($arFields["PREVIEW_PICTURE"]["tmp_name"]));
     }
     if (isset($arFields["DETAIL_PICTURE"]) && $arFields["DETAIL_PICTURE"]["COPY_FILE"] == "Y" && $arFields["DETAIL_PICTURE"]["copy"]) {
         @unlink($arFields["DETAIL_PICTURE"]["tmp_name"]);
         @rmdir(dirname($arFields["DETAIL_PICTURE"]["tmp_name"]));
     }
     foreach (GetModuleEvents("iblock", "OnAfterIBlockElementUpdate", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array(&$arFields));
     }
     CIBlock::clearIblockTagCache($arIBlock['ID']);
     return $Result;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:iblockelement.php

示例5: Delete


//.........这里部分代码省略.........
         CFile::Delete($s["PICTURE"]);
         CFile::Delete($s["DETAIL_PICTURE"]);
         static $arDelCache;
         if (!is_array($arDelCache)) {
             $arDelCache = array();
         }
         if (!is_set($arDelCache, $s["IBLOCK_ID"])) {
             $arDelCache[$s["IBLOCK_ID"]] = false;
             $db_ps = $DB->Query("SELECT ID,IBLOCK_ID,VERSION,MULTIPLE FROM b_iblock_property WHERE PROPERTY_TYPE='G' AND (LINK_IBLOCK_ID=" . $s["IBLOCK_ID"] . " OR LINK_IBLOCK_ID=0 OR LINK_IBLOCK_ID IS NULL)", false, $err_mess . __LINE__);
             while ($ar_ps = $db_ps->Fetch()) {
                 if ($ar_ps["VERSION"] == 2) {
                     if ($ar_ps["MULTIPLE"] == "Y") {
                         $strTable = "b_iblock_element_prop_m" . $ar_ps["IBLOCK_ID"];
                     } else {
                         $strTable = "b_iblock_element_prop_s" . $ar_ps["IBLOCK_ID"];
                     }
                 } else {
                     $strTable = "b_iblock_element_property";
                 }
                 $arDelCache[$s["IBLOCK_ID"]][$strTable][] = $ar_ps["ID"];
             }
         }
         if ($arDelCache[$s["IBLOCK_ID"]]) {
             foreach ($arDelCache[$s["IBLOCK_ID"]] as $strTable => $arProps) {
                 if (strncmp("b_iblock_element_prop_s", $strTable, 23) == 0) {
                     $tableFields = $DB->GetTableFields($strTable);
                     foreach ($arProps as $prop_id) {
                         $strSql = "UPDATE " . $strTable . " SET PROPERTY_" . $prop_id . "=null";
                         if (isset($tableFields["DESCRIPTION_" . $prop_id])) {
                             $strSql .= ",DESCRIPTION_" . $prop_id . "=null";
                         }
                         $strSql .= " WHERE PROPERTY_" . $prop_id . "=" . $s["ID"];
                         if (!$DB->Query($strSql, false, $err_mess . __LINE__)) {
                             return false;
                         }
                     }
                 } elseif (strncmp("b_iblock_element_prop_m", $strTable, 23) == 0) {
                     $tableFields = $DB->GetTableFields(str_replace("prop_m", "prop_s", $strTable));
                     $strSql = "SELECT IBLOCK_PROPERTY_ID, IBLOCK_ELEMENT_ID FROM " . $strTable . " WHERE IBLOCK_PROPERTY_ID IN (" . implode(", ", $arProps) . ") AND VALUE_NUM=" . $s["ID"];
                     $rs = $DB->Query($strSql, false, $err_mess . __LINE__);
                     while ($ar = $rs->Fetch()) {
                         $strSql = "\n\t\t\t\t\t\t\t\tUPDATE " . str_replace("prop_m", "prop_s", $strTable) . "\n\t\t\t\t\t\t\t\tSET\tPROPERTY_" . $ar["IBLOCK_PROPERTY_ID"] . "=null\n\t\t\t\t\t\t\t\t\t" . (isset($tableFields["DESCRIPTION_" . $ar["IBLOCK_PROPERTY_ID"]]) ? ",DESCRIPTION_" . $ar["IBLOCK_PROPERTY_ID"] . "=null" : "") . "\n\t\t\t\t\t\t\t\tWHERE IBLOCK_ELEMENT_ID = " . $ar["IBLOCK_ELEMENT_ID"] . "\n\t\t\t\t\t\t\t";
                         if (!$DB->Query($strSql, false, $err_mess . __LINE__)) {
                             return false;
                         }
                     }
                     $strSql = "DELETE FROM " . $strTable . " WHERE IBLOCK_PROPERTY_ID IN (" . implode(", ", $arProps) . ") AND VALUE_NUM=" . $s["ID"];
                     if (!$DB->Query($strSql, false, $err_mess . __LINE__)) {
                         return false;
                     }
                 } else {
                     $strSql = "DELETE FROM " . $strTable . " WHERE IBLOCK_PROPERTY_ID IN (" . implode(", ", $arProps) . ") AND VALUE_NUM=" . $s["ID"];
                     if (!$DB->Query($strSql, false, $err_mess . __LINE__)) {
                         return false;
                     }
                 }
             }
         }
         CIBlockSectionPropertyLink::DeleteBySection($ID);
         $DB->Query("DELETE FROM b_iblock_section_element WHERE IBLOCK_SECTION_ID=" . IntVal($ID), false, $err_mess . __LINE__);
         if (CModule::IncludeModule("search")) {
             CSearch::DeleteIndex("iblock", "S" . $ID);
         }
         $GLOBALS["USER_FIELD_MANAGER"]->Delete("IBLOCK_" . $s["IBLOCK_ID"] . "_SECTION", $ID);
         //Delete the hole in the tree
         $ss = $DB->Query("\n\t\t\t\tSELECT\n\t\t\t\t\tIBLOCK_ID,\n\t\t\t\t\tLEFT_MARGIN,\n\t\t\t\t\tRIGHT_MARGIN\n\t\t\t\tFROM\n\t\t\t\t\tb_iblock_section\n\t\t\t\tWHERE\n\t\t\t\t\tID = " . $s["ID"] . "\n\t\t\t");
         $ss = $ss->Fetch();
         if ($ss["RIGHT_MARGIN"] > 0 && $ss["LEFT_MARGIN"] > 0) {
             $DB->Query("\n\t\t\t\t\tUPDATE b_iblock_section SET\n\t\t\t\t\t\tTIMESTAMP_X=" . ($DB->type == "ORACLE" ? "NULL" : "TIMESTAMP_X") . "\n\t\t\t\t\t\t,RIGHT_MARGIN = RIGHT_MARGIN - 2\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tIBLOCK_ID = " . $ss["IBLOCK_ID"] . "\n\t\t\t\t\t\tAND RIGHT_MARGIN > " . $ss["RIGHT_MARGIN"] . "\n\t\t\t\t");
             $DB->Query("\n\t\t\t\t\tUPDATE b_iblock_section SET\n\t\t\t\t\t\tTIMESTAMP_X=" . ($DB->type == "ORACLE" ? "NULL" : "TIMESTAMP_X") . "\n\t\t\t\t\t\t,LEFT_MARGIN = LEFT_MARGIN - 2\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tIBLOCK_ID = " . $ss["IBLOCK_ID"] . "\n\t\t\t\t\t\tAND LEFT_MARGIN > " . $ss["LEFT_MARGIN"] . "\n\t\t\t\t");
         }
         $obSectionRights = new CIBlockSectionRights($s["IBLOCK_ID"], $ID);
         $obSectionRights->DeleteAllRights();
         $ipropTemplates = new \Bitrix\Iblock\InheritedProperty\SectionTemplates($s["IBLOCK_ID"], $ID);
         $ipropTemplates->delete();
         /************* QUOTA *************/
         $_SESSION["SESS_RECOUNT_DB"] = "Y";
         /************* QUOTA *************/
         $arIBlockFields = CIBlock::GetArrayByID($s["IBLOCK_ID"], "FIELDS");
         if ($arIBlockFields["LOG_SECTION_DELETE"]["IS_REQUIRED"] == "Y") {
             $USER_ID = is_object($USER) ? intval($USER->GetID()) : 0;
             $arEvents = GetModuleEvents("main", "OnBeforeEventLog", true);
             if (empty($arEvents) || ExecuteModuleEventEx($arEvents[0], array($USER_ID)) === false) {
                 $rsSection = CIBlockSection::GetList(array(), array("=ID" => $ID, "CHECK_PERMISSIONS" => $bCheckPermissions ? "Y" : "N"), false, array("LIST_PAGE_URL", "NAME", "CODE"));
                 $arSection = $rsSection->GetNext();
                 $res = array("ID" => $ID, "CODE" => $arSection["CODE"], "NAME" => $arSection["NAME"], "SECTION_NAME" => CIBlock::GetArrayByID($s["IBLOCK_ID"], "SECTION_NAME"), "USER_ID" => $USER_ID, "IBLOCK_PAGE_URL" => $arSection["LIST_PAGE_URL"]);
                 CEventLog::Log("IBLOCK", "IBLOCK_SECTION_DELETE", "iblock", $s["IBLOCK_ID"], serialize($res));
             }
         }
         $res = $DB->Query("DELETE FROM b_iblock_section WHERE ID=" . IntVal($ID), false, $err_mess . __LINE__);
         if ($res) {
             foreach (GetModuleEvents("iblock", "OnAfterIBlockSectionDelete", true) as $arEvent) {
                 ExecuteModuleEventEx($arEvent, array($s));
             }
             CIBlock::clearIblockTagCache($s['IBLOCK_ID']);
         }
         return $res;
     }
     return true;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:iblocksection.php

示例6: SetRights

 function SetRights($arRights)
 {
     global $DB;
     if (!$this->_self_check()) {
         return false;
     }
     $arDBRights = $this->GetRights();
     $arTasks = $this->GetRightsList(false);
     $arAddedCodes = array();
     $arUniqCodes = array();
     foreach ($arRights as $RIGHT_ID => $arRightSet) {
         if (strlen($arRightSet["GROUP_CODE"]) > 0) {
             if (isset($arUniqCodes[$arRightSet["GROUP_CODE"]])) {
                 unset($arRights[$RIGHT_ID]);
             } else {
                 $arUniqCodes[$arRightSet["GROUP_CODE"]] = true;
             }
         }
     }
     //Fix broken TASK_ID
     foreach ($arRights as $RIGHT_ID => $arRightSet) {
         if (!is_array($arRightSet["TASK_ID"]) && !array_key_exists($arRightSet["TASK_ID"], $arTasks) && array_key_exists($RIGHT_ID, $arDBRights)) {
             $arRights[$RIGHT_ID]["TASK_ID"] = $arDBRights[$RIGHT_ID]["TASK_ID"];
         }
     }
     $bCleanUp = false;
     $obStorage = $this->_storage_object();
     foreach ($arRights as $RIGHT_ID => $arRightSet) {
         $ID = intval($RIGHT_ID);
         $GROUP_CODE = $arRightSet["GROUP_CODE"];
         $bInherit = true;
         //$arRightSet["DO_INHERIT"] == "Y";
         if (strlen($GROUP_CODE) <= 0 || is_array($arRightSet["TASK_ID"])) {
             continue;
         }
         if (!array_key_exists($arRightSet["TASK_ID"], $arTasks)) {
             continue;
         }
         if (array_key_exists($RIGHT_ID, $arDBRights) && isset($arRightSet["DO_CLEAN"]) && $arRightSet["DO_CLEAN"] == "Y") {
             $obStorage->DeleteChildrenSet($GROUP_CODE, CIBlockRights::GROUP_CODE);
             $bCleanUp = true;
         }
         if (substr($RIGHT_ID, 0, 1) == "n") {
             $arAddedCodes[$GROUP_CODE] = $GROUP_CODE;
             $NEW_RIGHT_ID = $this->_add($GROUP_CODE, $bInherit, $arRightSet["TASK_ID"], isset($arRightSet["XML_ID"]) ? $arRightSet["XML_ID"] : false);
             if (!isset($arRightSet["DO_CLEAN"]) || $arRightSet["DO_CLEAN"] !== "NOT") {
                 $obStorage->DeleteSelfSet($GROUP_CODE, CIBlockRights::GROUP_CODE);
             }
             $obStorage->AddSelfSet($NEW_RIGHT_ID);
             if (!isset($arRightSet["DO_CLEAN"]) || $arRightSet["DO_CLEAN"] !== "NOT") {
                 $obStorage->DeleteChildrenSet($GROUP_CODE, CIBlockRights::GROUP_CODE);
             }
             if ($bInherit) {
                 $obStorage->AddChildrenSet($NEW_RIGHT_ID, $GROUP_CODE, true);
             }
         } elseif (array_key_exists($ID, $arDBRights) && $arDBRights[$ID]["IS_INHERITED"] != "Y") {
             $this->_update($ID, $GROUP_CODE, $bInherit, $arRightSet["TASK_ID"]);
             //This not possible to change group code in _update
             //$obStorage->DeleteChildrenSet($ID, CIBlockRights::RIGHT_ID);
             //if($bInherit)
             //	$obStorage->AddChildrenSet($ID, $GROUP_CODE, /*$bInherited=*/true);
             unset($arDBRights[$ID]);
         }
     }
     foreach ($arDBRights as $RIGHT_ID => $arRightSet) {
         if ($arRightSet["IS_INHERITED"] == "Y") {
             continue;
         }
         $obStorage->DeleteSelfSet($RIGHT_ID, CIBlockRights::RIGHT_ID);
         if ($arRightSet["DO_INHERIT"] == "Y") {
             $obStorage->DeleteChildrenSet($RIGHT_ID, CIBlockRights::RIGHT_ID);
         }
         $this->_delete($RIGHT_ID);
         if (!isset($arAddedCodes[$arRightSet["GROUP_CODE"]])) {
             foreach ($obStorage->FindParentWithInherit($arRightSet["GROUP_CODE"]) as $SECTION_ID => $PARENT_RIGHT) {
                 $obStorage->AddSelfSet($PARENT_RIGHT, true);
                 $obStorage->AddChildrenSet($PARENT_RIGHT, $arRightSet["GROUP_CODE"], true);
             }
         }
     }
     if ($bCleanUp) {
         $obStorage->CleanUp();
     }
     CIBlock::clearIblockTagCache($this->IBLOCK_ID);
     return true;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:86,代码来源:iblock_rights.php

示例7: GetMessage

                $res = $obProperty->Add(array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "ACTIVE" => "Y", "PROPERTY_TYPE" => "N", "MULTIPLE" => "N", "NAME" => GetMessage("CC_BIV_VOTE_RATING"), "CODE" => "rating"));
                if ($res) {
                    $arProperties["rating"] = array("VALUE" => 0);
                }
            }
            if ($res) {
                $arProperties["vote_count"]["VALUE"] = intval($arProperties["vote_count"]["VALUE"]) + 1;
                $arProperties["vote_sum"]["VALUE"] = intval($arProperties["vote_sum"]["VALUE"]) + $RATING;
                //rating = (SUM(vote)+31.25) / (COUNT(*)+10)
                $arProperties["rating"]["VALUE"] = round(($arProperties["vote_sum"]["VALUE"] + 31.25 / 5 * $arParams["MAX_VOTE"]) / ($arProperties["vote_count"]["VALUE"] + 10), 2);
                $DB->StartTransaction();
                CIBlockElement::SetPropertyValuesEx($ELEMENT_ID, $arParams["IBLOCK_ID"], array("vote_count" => array("VALUE" => $arProperties["vote_count"]["VALUE"], "DESCRIPTION" => $arProperties["vote_count"]["DESCRIPTION"]), "vote_sum" => array("VALUE" => $arProperties["vote_sum"]["VALUE"], "DESCRIPTION" => $arProperties["vote_sum"]["DESCRIPTION"]), "rating" => array("VALUE" => $arProperties["rating"]["VALUE"], "DESCRIPTION" => $arProperties["rating"]["DESCRIPTION"])));
                $DB->Commit();
                $this->ClearResultCache(array($USER->GetGroups(), 1));
                $this->ClearResultCache(array($USER->GetGroups(), 0));
                CIBlock::clearIblockTagCache($arParams['IBLOCK_ID']);
            }
        }
    }
    //27*
    //Нам нет необходимости делать редирект для обновления данных
    //в аякс режиме
    //да и не приведет это ни к чему
    if ($_REQUEST["AJAX_CALL"] != "Y") {
        LocalRedirect(!empty($_REQUEST["back_page"]) ? $_REQUEST["back_page"] : $APPLICATION->GetCurPageParam());
    }
}
//28*
//Начинаем исполнять "шаблон"
$bVoted = is_array($_SESSION["IBLOCK_RATING"]) && array_key_exists($arParams["ELEMENT_ID"], $_SESSION["IBLOCK_RATING"]) ? 1 : 0;
if ($this->StartResultCache(false, array($USER->GetGroups(), $bVoted))) {
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php


注:本文中的CIBlock::clearIblockTagCache方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。