- Модуль: socialnetwork
- Путь к файлу: ~/bitrix/modules/socialnetwork/classes/mysql/group_features_perms.php
- Класс: CSocNetFeaturesPerms
- Вызов: CSocNetFeaturesPerms::Add
static function Add($arFields)
{
global $DB, $CACHE_MANAGER;
$arFields1 = BitrixSocialnetworkUtil::getEqualityFields($arFields);
if (!CSocNetFeaturesPerms::CheckFields("ADD", $arFields))
{
return false;
}
$db_events = GetModuleEvents("socialnetwork", "OnBeforeSocNetFeaturesPermsAdd");
while ($arEvent = $db_events->Fetch())
{
if (ExecuteModuleEventEx($arEvent, array($arFields)) === false)
{
return false;
}
}
$arInsert = $DB->PrepareInsert("b_sonet_features2perms", $arFields);
BitrixSocialnetworkUtil::processEqualityFieldsToInsert($arFields1, $arInsert);
$ID = false;
if ($arInsert[0] <> '')
{
$strSql =
"INSERT INTO b_sonet_features2perms(".$arInsert[0].") ".
"VALUES(".$arInsert[1].")";
$DB->Query($strSql, False, "File: ".__FILE__."
Line: ".__LINE__);
$ID = intval($DB->LastID());
$events = GetModuleEvents("socialnetwork", "OnSocNetFeaturesPermsAdd");
while ($arEvent = $events->Fetch())
{
ExecuteModuleEventEx($arEvent, array($ID, $arFields));
}
if (
intval($arFields["FEATURE_ID"]) > 0
&& defined("BX_COMP_MANAGED_CACHE")
)
{
$CACHE_MANAGER->ClearByTag('sonet_features2perms');
$CACHE_MANAGER->ClearByTag("sonet_feature_".$arFields["FEATURE_ID"]);
}
}
return $ID;
}