當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CSocNetLog::DeleteSystemEventsByGroupID方法代碼示例

本文整理匯總了PHP中CSocNetLog::DeleteSystemEventsByGroupID方法的典型用法代碼示例。如果您正苦於以下問題:PHP CSocNetLog::DeleteSystemEventsByGroupID方法的具體用法?PHP CSocNetLog::DeleteSystemEventsByGroupID怎麽用?PHP CSocNetLog::DeleteSystemEventsByGroupID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CSocNetLog的用法示例。


在下文中一共展示了CSocNetLog::DeleteSystemEventsByGroupID方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: Delete

 function Delete($ID)
 {
     global $DB;
     if (!CSocNetGroup::__ValidateID($ID)) {
         return false;
     }
     $ID = IntVal($ID);
     $bSuccess = True;
     $db_events = GetModuleEvents("socialnetwork", "OnBeforeSocNetGroupDelete");
     while ($arEvent = $db_events->Fetch()) {
         if (ExecuteModuleEventEx($arEvent, array($ID)) === false) {
             return false;
         }
     }
     $arGroup = CSocNetGroup::GetByID($ID);
     if (!$arGroup) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_NO_GROUP"), "ERROR_NO_GROUP");
         return false;
     }
     $DB->StartTransaction();
     $events = GetModuleEvents("socialnetwork", "OnSocNetGroupDelete");
     while ($arEvent = $events->Fetch()) {
         ExecuteModuleEventEx($arEvent, array($ID));
     }
     if ($bSuccess) {
         $bSuccess = $DB->Query("DELETE FROM b_sonet_user2group WHERE GROUP_ID = " . $ID . "", true);
     }
     if ($bSuccess) {
         $bSuccessTmp = true;
         $dbResult = CSocNetFeatures::GetList(array(), array("ENTITY_ID" => $ID, "ENTITY_TYPE" => SONET_ENTITY_GROUP));
         while ($arResult = $dbResult->Fetch()) {
             $bSuccessTmp = $DB->Query("DELETE FROM b_sonet_features2perms WHERE FEATURE_ID = " . $arResult["ID"] . "", true);
             if (!$bSuccessTmp) {
                 break;
             }
         }
         if (!$bSuccessTmp) {
             $bSuccess = false;
         }
     }
     if ($bSuccess) {
         $bSuccess = $DB->Query("DELETE FROM b_sonet_features WHERE ENTITY_ID = " . $ID . " AND ENTITY_TYPE = '" . $DB->ForSql(SONET_ENTITY_GROUP, 1) . "'", true);
     }
     if ($bSuccess) {
         $dbResult = CSocNetLog::GetList(array(), array("ENTITY_ID" => $ID, "ENTITY_TYPE" => SONET_ENTITY_GROUP), false, false, array("ID"));
         while ($arResult = $dbResult->Fetch()) {
             $bSuccessTmp = $DB->Query("DELETE FROM b_sonet_log_site WHERE LOG_ID = " . $arResult["ID"] . "", true);
             if (!$bSuccessTmp) {
                 break;
             }
             $bSuccessTmp = $DB->Query("DELETE FROM b_sonet_log_right WHERE LOG_ID = " . $arResult["ID"] . "", true);
             if (!$bSuccessTmp) {
                 break;
             }
         }
         if (!$bSuccessTmp) {
             $bSuccess = false;
         }
     }
     if ($bSuccess) {
         $bSuccess = $DB->Query("DELETE FROM b_sonet_log WHERE ENTITY_TYPE = '" . SONET_ENTITY_GROUP . "' AND ENTITY_ID = " . $ID . "", true);
     }
     if ($bSuccess) {
         $bSuccess = CSocNetLog::DeleteSystemEventsByGroupID($ID);
     }
     if ($bSuccess) {
         $bSuccess = $DB->Query("DELETE FROM b_sonet_log_events WHERE ENTITY_TYPE = 'G' AND ENTITY_ID = " . $ID . "", true);
     }
     if ($bSuccess) {
         $bSuccess = $DB->Query("DELETE FROM b_sonet_group_site WHERE GROUP_ID = " . $ID . "", true);
     }
     if ($bSuccess) {
         $bSuccess = $DB->Query("DELETE FROM b_sonet_log_right WHERE GROUP_CODE LIKE 'SG" . $ID . "\\_%' OR GROUP_CODE = 'SG" . $ID . "'", true);
     }
     if ($bSuccess) {
         $bSuccess = CSocNetSubscription::DeleteEx(false, "SG" . $ID);
     }
     if ($bSuccess) {
         CFile::Delete($arGroup["IMAGE_ID"]);
         $bSuccess = $DB->Query("DELETE FROM b_sonet_group WHERE ID = " . $ID . "", true);
     }
     if ($bSuccess) {
         CUserOptions::DeleteOption("socialnetwork", "~menu_" . SONET_ENTITY_GROUP . "_" . $ID, false, 0);
         unset($GLOBALS["SONET_GROUP_CACHE"][$ID]);
     }
     if ($bSuccess) {
         $DB->Commit();
     } else {
         $DB->Rollback();
     }
     if ($bSuccess) {
         unset($GLOBALS["SONET_GROUP_CACHE"][$ID]);
         if (defined("BX_COMP_MANAGED_CACHE")) {
             $GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_user2group_G" . $ID);
             $GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_user2group");
             $GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_group_" . $ID);
             $GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_group");
         }
     }
     if ($bSuccess && CModule::IncludeModule("search")) {
//.........這裏部分代碼省略.........
開發者ID:DarneoStudio,項目名稱:bitrix,代碼行數:101,代碼來源:group.php


注:本文中的CSocNetLog::DeleteSystemEventsByGroupID方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。