function Delete($ID) { /** * @global CMain $APPLICATION * @global CDatabase $DB */ global $APPLICATION; $ID = Intval($ID); foreach (GetModuleEvents("main", "OnBeforeEventMessageDelete", true) as $arEvent) { if (ExecuteModuleEventEx($arEvent, array($ID)) === false) { $err = GetMessage("MAIN_BEFORE_DEL_ERR") . ' ' . $arEvent['TO_NAME']; if ($ex = $APPLICATION->GetException()) { $err .= ': ' . $ex->GetString(); } $APPLICATION->throwException($err); return false; } } @set_time_limit(600); //check module event for OnDelete foreach (GetModuleEvents("main", "OnEventMessageDelete", true) as $arEvent) { ExecuteModuleEventEx($arEvent, array($ID)); } Mail\Internal\EventMessageSiteTable::delete($ID); $result = Mail\Internal\EventMessageTable::delete($ID); if ($result->isSuccess()) { $res = new CDBResultEventMultiResult(); $res->affectedRowsCount = 1; } else { $res = false; } return $res; }
/** * @param $sites * @return array * @throws \Bitrix\Main\ArgumentException * @throws \Bitrix\Main\ArgumentNullException */ protected function getSiteFieldsArray($sites) { /* global $BX_EVENT_SITE_PARAMS; if($site_id !== false && isset($BX_EVENT_SITE_PARAMS[$site_id])) return $BX_EVENT_SITE_PARAMS[$site_id]; */ $site_id = $sites[0]; if (!empty($this->eventMessageId)) { $messageSiteDb = MailInternal\EventMessageSiteTable::getList(array('select' => array('SITE_ID'), 'filter' => array('EVENT_MESSAGE_ID' => $this->eventMessageId, 'SITE_ID' => $sites))); if ($arMessageSite = $messageSiteDb->Fetch()) { $site_id = $arMessageSite['SITE_ID']; } } $SITE_NAME = Config\Option::get("main", "site_name", $GLOBALS["SERVER_NAME"]); $SERVER_NAME = Config\Option::get("main", "server_name", $GLOBALS["SERVER_NAME"]); $DEFAULT_EMAIL_FROM = Config\Option::get("main", "email_from", "admin@" . $GLOBALS["SERVER_NAME"]); if (strlen($site_id) > 0) { $result = \Bitrix\Main\SiteTable::getById($site_id); if ($arSite = $result->fetch()) { $this->siteId = $arSite['LID']; $this->languageId = $arSite['LANGUAGE_ID']; $BX_EVENT_SITE_PARAMS[$site_id] = array("SITE_NAME" => $arSite["SITE_NAME"] != '' ? $arSite["SITE_NAME"] : $SITE_NAME, "SERVER_NAME" => $arSite["SERVER_NAME"] != '' ? $arSite["SERVER_NAME"] : $SERVER_NAME, "DEFAULT_EMAIL_FROM" => $arSite["EMAIL"] != '' ? $arSite["EMAIL"] : $DEFAULT_EMAIL_FROM, "LANGUAGE_ID" => $arSite['LANGUAGE_ID'], "SITE_ID" => $arSite['LID'], "SITE_DIR" => $arSite['DIR']); return $BX_EVENT_SITE_PARAMS[$site_id]; } } return array("SITE_NAME" => $SITE_NAME, "SERVER_NAME" => $SERVER_NAME, "DEFAULT_EMAIL_FROM" => $DEFAULT_EMAIL_FROM); }