/** * @param null $mailingId * @param null $mailingChainId * @throws \Bitrix\Main\ArgumentException */ public static function actualizeAgent($mailingId = null, $mailingChainId = null) { $agent = new \CAgent(); $isSendByTimeMethodCron = \COption::GetOptionInt("sender", "auto_method") === 'cron'; $arFilter = array(); if ($mailingId) { $arFilter['=MAILING_ID'] = $mailingId; } if ($mailingChainId) { $arFilter['=ID'] = $mailingChainId; } $mailingChainDb = MailingChainTable::getList(array('select' => array('ID', 'STATUS', 'AUTO_SEND_TIME', 'MAILING_ACTIVE' => 'MAILING.ACTIVE'), 'filter' => $arFilter)); while ($mailingChain = $mailingChainDb->fetch()) { $agentName = static::getAgentName($mailingChain['ID']); $rsAgents = $agent->GetList(array("ID" => "DESC"), array("MODULE_ID" => "sender", "NAME" => $agentName)); while ($arAgent = $rsAgents->Fetch()) { $agent->Delete($arAgent["ID"]); } if ($isSendByTimeMethodCron || $mailingChain['REITERATE'] != 'Y' && empty($mailingChain['AUTO_SEND_TIME'])) { continue; } if ($mailingChain['MAILING_ACTIVE'] == 'Y' && $mailingChain['STATUS'] == MailingChainTable::STATUS_SEND) { if (!empty($mailingChain['AUTO_SEND_TIME'])) { $dateExecute = $mailingChain['AUTO_SEND_TIME']; } else { $dateExecute = ""; } $agent->AddAgent($agentName, "sender", "N", 0, null, "Y", $dateExecute); } } }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { @set_time_limit(0); @ignore_user_abort(true); define('CHK_EVENT', true); $agentManager = new \CAgent(); $agentManager->CheckAgents(); define('BX_CRONTAB_SUPPORT', true); define('BX_CRONTAB', true); $eventManager = new \CEvent(); $eventManager->CheckEvents(); }
function InstallDB() { global $DB, $APPLICATION; $this->errors = false; if(!$DB->Query("SELECT 'x' FROM b_pull_stack", true)) $this->errors = $DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT']."/bitrix/modules/pull/install/db/".strtolower($DB->type)."/install.sql"); if($this->errors !== false) { $APPLICATION->ThrowException(implode("", $this->errors)); return false; } RegisterModule("pull"); RegisterModuleDependences("main", "OnProlog", "main", "", "", 3, "/modules/pull/ajax_hit.php"); RegisterModuleDependences("perfmon", "OnGetTableSchema", "pull", "CPullTableSchema", "OnGetTableSchema"); RegisterModuleDependences("main", "OnAfterRegisterModule", "pull", "CPullOptions", "ClearCheckCache"); RegisterModuleDependences("main", "OnAfterUnRegisterModule", "pull", "CPullOptions", "ClearCheckCache"); COption::SetOptionString("pull", "path_to_listener", (CMain::IsHTTPS() ? "https" : "http")."://#DOMAIN#".(CMain::IsHTTPS() ? ":8894" : ":8893").'/bitrix/sub/'); COption::SetOptionString("pull", "path_to_websocket", (CMain::IsHTTPS() ? "wss" : "ws")."://#DOMAIN#".(CMain::IsHTTPS() ? ":8894" : ":8893").'/bitrix/subws/'); COption::SetOptionString("pull", "path_to_publish", 'http://127.0.0.1:8895/bitrix/pub/'); COption::SetOptionString("pull", "websocket", 'N'); COption::SetOptionString("pull", "nginx", 'N'); COption::SetOptionString("pull", "push", 'N'); CAgent::AddAgent("CPullOptions::ClearAgent();", "pull", "N", 30, "", "Y", ConvertTimeStamp(time()+CTimeZone::GetOffset()+30, "FULL")); return true; }
function InstallDB($arParams = array()) { global $DB, $DBType, $APPLICATION; $this->errors = false; // Database tables creation $bDBInstall = !$DB->Query("SELECT 'x' FROM b_workflow_document WHERE 1=0", true); if ($bDBInstall) { $this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/workflow/install/db/" . $DBType . "/install.sql"); } if ($this->errors !== false) { $APPLICATION->ThrowException(implode("<br>", $this->errors)); return false; } else { RegisterModule("workflow"); CModule::IncludeModule("workflow"); if ($bDBInstall) { $obWorkflowStatus = new CWorkflowStatus(); $obWorkflowStatus->Add(array("~TIMESTAMP_X" => $DB->GetNowFunction(), "C_SORT" => 300, "ACTIVE" => "Y", "TITLE" => GetMessage("FLOW_INSTALL_PUBLISHED"), "IS_FINAL" => "Y", "NOTIFY" => "N")); $obWorkflowStatus->Add(array("~TIMESTAMP_X" => $DB->GetNowFunction(), "C_SORT" => 100, "ACTIVE" => "Y", "TITLE" => GetMessage("FLOW_INSTALL_DRAFT"), "IS_FINAL" => "N", "NOTIFY" => "N")); $obWorkflowStatus->Add(array("~TIMESTAMP_X" => $DB->GetNowFunction(), "C_SORT" => 200, "ACTIVE" => "Y", "TITLE" => GetMessage("FLOW_INSTALL_READY"), "IS_FINAL" => "N", "NOTIFY" => "Y")); } RegisterModuleDependences("main", "OnPanelCreate", "workflow", "CWorkflow", "OnPanelCreate", "200"); RegisterModuleDependences("main", "OnChangeFile", "workflow", "CWorkflow", "OnChangeFile"); //agents CAgent::RemoveAgent("CWorkflow::CleanUp();", "workflow"); CAgent::AddAgent("CWorkflow::CleanUp();", "workflow", "N"); return true; } }
function UnInstallDB($arParams = array()) { global $DB, $DBType, $APPLICATION; $this->errors = false; if (!array_key_exists("save_tables", $arParams) || $arParams["save_tables"] != "Y") { $this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sender/install/db/" . $DBType . "/uninstall.sql"); } CAgent::RemoveModuleAgents('sender'); UnRegisterModuleDependences("main", "OnMailEventMailRead", "sender", "bitrix\\sender\\postingmanager", "onMailEventMailRead"); UnRegisterModuleDependences("main", "OnMailEventMailClick", "sender", "bitrix\\sender\\postingmanager", "onMailEventMailClick"); UnRegisterModuleDependences("main", "OnMailEventSubscriptionDisable", "sender", "Bitrix\\Sender\\Subscription", "onMailEventSubscriptionDisable"); UnRegisterModuleDependences("main", "OnMailEventSubscriptionEnable", "sender", "Bitrix\\Sender\\Subscription", "onMailEventSubscriptionEnable"); UnRegisterModuleDependences("main", "OnMailEventSubscriptionList", "sender", "Bitrix\\Sender\\Subscription", "onMailEventSubscriptionList"); UnRegisterModuleDependences("sender", "OnConnectorList", "sender", "bitrix\\sender\\connectormanager", "onConnectorListContact"); UnRegisterModuleDependences("sender", "OnConnectorList", "sender", "bitrix\\sender\\connectormanager", "onConnectorListRecipient"); UnRegisterModuleDependences("sender", "OnPresetTemplateList", "sender", "Bitrix\\Sender\\Preset\\TemplateBase", "onPresetTemplateList"); UnRegisterModuleDependences("sender", "OnPresetTemplateList", "sender", "Bitrix\\Sender\\TemplateTable", "onPresetTemplateList"); UnRegisterModuleDependences("sender", "OnPresetMailBlockList", "sender", "Bitrix\\Sender\\Preset\\MailBlockBase", "OnPresetMailBlockList"); UnRegisterModule("sender"); if ($this->errors !== false) { $APPLICATION->ThrowException(implode("<br>", $this->errors)); return false; } return true; }
function InstallDB($arParams = array()) { global $DB, $DBType, $APPLICATION; $this->errors = false; // Database tables creation if (!$DB->Query("SELECT 'x' FROM b_list_rubric WHERE 1=0", true)) { $this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/subscribe/install/db/" . $DBType . "/install.sql"); } if ($this->errors !== false) { $APPLICATION->ThrowException(implode("<br>", $this->errors)); return false; } else { RegisterModule("subscribe"); CModule::IncludeModule("subscribe"); RegisterModuleDependences("main", "OnBeforeLangDelete", "subscribe", "CRubric", "OnBeforeLangDelete"); RegisterModuleDependences("main", "OnUserDelete", "subscribe", "CSubscription", "OnUserDelete"); RegisterModuleDependences("main", "OnUserLogout", "subscribe", "CSubscription", "OnUserLogout"); RegisterModuleDependences("main", "OnGroupDelete", "subscribe", "CPosting", "OnGroupDelete"); //agents CAgent::RemoveAgent("CSubscription::CleanUp();", "subscribe"); CTimeZone::Disable(); CAgent::Add(array("NAME" => "CSubscription::CleanUp();", "MODULE_ID" => "subscribe", "ACTIVE" => "Y", "NEXT_EXEC" => date("d.m.Y H:i:s", mktime(3, 0, 0, date("m"), date("j") + 1, date("Y"))), "AGENT_INTERVAL" => 86400, "IS_PERIOD" => "Y")); CTimeZone::Enable(); return true; } }
public static function AgentRun($profileID, $in_agent = "N") { global $DB; $agent_ID = 0; $pr = CProfileAdmin::GetByID($profileID)->Fetch(); $datacheck = date("d.m.Y H:i:s", $pr["DATA_START"]); $agent_period = intval($pr["PERIOD"]); if ($agent_period <= 0) { $agent_period = 86400; } if ($profileID > 0) { if ($in_agent == "Y") { CAgent::RemoveAgent("CGM::ReturnXMLData(" . $profileID . ");", "acrit.googlemerchant"); } else { $arAgent = CAgent::GetList(array(), array("NAME" => "CGM::ReturnXMLData(" . $profileID . ");"))->Fetch(); if (!$arAgent) { $agent_ID = CAgent::AddAgent("CGM::ReturnXMLData(" . $profileID . ");", "acrit.googlemerchant", "N", $agent_period, $datacheck, "Y", $datacheck, 100); } elseif ($arAgent) { if ($arAgent['NEXT_EXEC'] > $datacheck) { $datacheck = $arAgent['NEXT_EXEC']; } CAgent::Update($arAgent['ID'], array("AGENT_INTERVAL" => $agent_period, "ACTIVE" => "Y", "NEXT_EXEC" => $datacheck)); } } } return $agent_ID; }
function UnInstallDB($arParams = array()) { global $APPLICATION, $DB, $DOCUMENT_ROOT; if(!array_key_exists("savedata", $arParams) || $arParams["savedata"] != "Y") { $errors = $DB->RunSQLBatch($DOCUMENT_ROOT."/bitrix/modules/socialservices/install/db/".strtolower($DB->type)."/uninstall.sql"); if (!empty($errors)) { $APPLICATION->ThrowException(implode("", $errors)); return false; } } UnRegisterModuleDependences("main", "OnUserDelete", "socialservices", "CSocServAuthDB", "OnUserDelete"); UnRegisterModuleDependences('socialnetwork', 'OnFillSocNetLogEvents', 'socialservices', 'CSocServEventHandlers', 'OnFillSocNetLogEvents'); UnRegisterModuleDependences('timeman', 'OnAfterTMReportDailyAdd', 'socialservices', 'CSocServAuthDB', 'OnAfterTMReportDailyAdd'); UnRegisterModuleDependences('timeman', 'OnAfterTMDayStart', 'socialservices', 'CSocServAuthDB', 'OnAfterTMDayStart'); UnRegisterModuleDependences('timeman', 'OnTimeManShow', 'socialservices', 'CSocServEventHandlers', 'OnTimeManShow'); $dbSites = CSite::GetList(($b="sort"), ($o="asc"), array("ACTIVE" => "Y")); while ($arSite = $dbSites->Fetch()) { $siteId = $arSite['ID']; CAgent::RemoveAgent("CSocServAuthManager::GetTwitMessages($siteId);", "socialservices"); } UnRegisterModule("socialservices"); return true; }
public static function CheckExpireAgent() { global $DB; if (!CPullOptions::ModuleEnable()) return false; CAgent::RemoveAgent("CPullWatch::CheckExpireAgent();", "pull"); $strSql = "SELECT count(ID) CNT FROM b_pull_watch WHERE DATE_CREATE < DATE_SUB(NOW(), INTERVAL 30 MINUTE)"; $dbRes = $DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__); if ($arRes = $dbRes->Fetch()) { $strSql = "DELETE FROM b_pull_watch WHERE DATE_CREATE < DATE_SUB(NOW(), INTERVAL 30 MINUTE) LIMIT 1000"; $DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__); if ($arRes['CNT'] > 1000) { CAgent::AddAgent("CPullWatch::CheckExpireAgent();", "pull", "N", 180, "", "Y", ConvertTimeStamp(time()+CTimeZone::GetOffset()+180, "FULL")); return false; } } CAgent::AddAgent("CPullWatch::CheckExpireAgent();", "pull", "N", 600, "", "Y", ConvertTimeStamp(time()+CTimeZone::GetOffset()+600, "FULL")); return false; }
function InstallDB($arParams = array()) { global $DB, $DBType, $APPLICATION; $this->errors = false; // Database tables creation if (!$DB->Query("SELECT 'x' FROM b_sec_iprule WHERE 1=0", true)) { $this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/security/install/db/" . strtolower($DB->type) . "/install.sql"); } if ($this->errors !== false) { $APPLICATION->ThrowException(implode("<br>", $this->errors)); return false; } else { $this->InstallTasks(); RegisterModule("security"); RegisterModuleDependences("main", "OnUserDelete", "security", "CSecurityUser", "OnUserDelete"); RegisterModuleDependences("main", "OnEventLogGetAuditTypes", "security", "CSecurityFilter", "GetAuditTypes"); RegisterModuleDependences("main", "OnEventLogGetAuditTypes", "security", "CSecurityAntiVirus", "GetAuditTypes"); RegisterModuleDependences("main", "OnAdminInformerInsertItems", "security", "CSecurityFilter", "OnAdminInformerInsertItems"); RegisterModuleDependences("main", "OnAdminInformerInsertItems", "security", "CSecuritySiteChecker", "OnAdminInformerInsertItems"); CModule::IncludeModule("security"); //agents CAgent::RemoveAgent("CSecuritySession::CleanUpAgent();", "security"); CAgent::Add(array("NAME" => "CSecuritySession::CleanUpAgent();", "MODULE_ID" => "security", "ACTIVE" => "Y", "AGENT_INTERVAL" => 1800, "IS_PERIOD" => "N")); CAgent::RemoveAgent("CSecurityIPRule::CleanUpAgent();", "security"); CAgent::Add(array("NAME" => "CSecurityIPRule::CleanUpAgent();", "MODULE_ID" => "security", "ACTIVE" => "Y", "AGENT_INTERVAL" => 3600, "IS_PERIOD" => "N")); if (!COption::GetOptionString("security", "ipcheck_disable_file")) { COption::SetOptionString("security", "ipcheck_disable_file", "/bitrix/modules/ipcheck_disable_" . md5(mt_rand())); } CAgent::RemoveAgent("CSecurityFilter::ClearTmpFiles();", "security"); CSecurityFilter::SetActive(true); CSecurityAntiVirus::SetActive(true); return true; } }
function InstallDB() { global $DB, $APPLICATION; $this->errors = false; if (!$DB->Query("SELECT 'x' FROM b_pull_stack", true)) { $this->errors = $DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/pull/install/db/" . strtolower($DB->type) . "/install.sql"); } if ($this->errors !== false) { $APPLICATION->ThrowException(implode("", $this->errors)); return false; } RegisterModule("pull"); RegisterModuleDependences("main", "OnProlog", "main", "", "", 3, "/modules/pull/ajax_hit.php"); RegisterModuleDependences("main", "OnEpilog", "pull", "CPullWatch", "DeferredSql"); RegisterModuleDependences("main", "OnEpilog", "pull", "CPullOptions", "OnEpilog"); RegisterModuleDependences("perfmon", "OnGetTableSchema", "pull", "CPullTableSchema", "OnGetTableSchema"); RegisterModuleDependences("main", "OnAfterRegisterModule", "pull", "CPullOptions", "ClearCheckCache"); RegisterModuleDependences("main", "OnAfterUnRegisterModule", "pull", "CPullOptions", "ClearCheckCache"); if (IsModuleInstalled('intranet')) { RegisterModuleDependences("main", "OnAfterUserAuthorize", "pull", "CPullChannel", "OnAfterUserAuthorize"); RegisterModuleDependences("main", "OnAfterUserLogout", "pull", "CPullChannel", "OnAfterUserLogout"); } CAgent::AddAgent("CPullOptions::ClearAgent();", "pull", "N", 30, "", "Y", ConvertTimeStamp(time() + CTimeZone::GetOffset() + 30, "FULL")); return true; }
function CheckAgents() { global $CACHE_MANAGER; //For a while agents will execute only on primary cluster group if (defined("NO_AGENT_CHECK") && NO_AGENT_CHECK === true || defined("BX_CLUSTER_GROUP") && BX_CLUSTER_GROUP !== 1) { return; } $agents_use_crontab = COption::GetOptionString("main", "agents_use_crontab", "N"); $str_crontab = ""; if ($agents_use_crontab == "Y" || defined("BX_CRONTAB_SUPPORT") && BX_CRONTAB_SUPPORT === true) { if (defined("BX_CRONTAB") && BX_CRONTAB === true) { $str_crontab = " AND IS_PERIOD='N' "; } else { $str_crontab = " AND IS_PERIOD='Y' "; } } $saved_time = 0; if (CACHED_b_agent !== false && $CACHE_MANAGER->Read(CACHED_b_agent, $cache_id = "agents" . $str_crontab, "agents")) { $saved_time = $CACHE_MANAGER->Get($cache_id); if (time() < $saved_time) { return ""; } } return CAgent::ExecuteAgents($str_crontab); }
function UnInstallDB($arParams = array()) { global $DB, $DBType, $APPLICATION; $this->errors = false; if (!array_key_exists("savedata", $arParams) || $arParams["savedata"] != "Y") { $this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/vote/install/db/" . strtolower($DB->type) . "/uninstall.sql"); } //delete agents CAgent::RemoveModuleAgents("vote"); $db_res = $DB->Query("SELECT ID FROM b_file WHERE MODULE_ID = 'vote'"); while ($arRes = $db_res->Fetch()) { CFile::Delete($arRes["ID"]); } // Events include $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/vote/install/events/del_events.php"; UnRegisterModuleDependences("im", "OnGetNotifySchema", "vote", "CVoteNotifySchema", "OnGetNotifySchema"); UnRegisterModuleDependences("main", "OnUserLogin", "vote", "CVoteUser", "OnUserLogin", 200); UnRegisterModuleDependences("main", "OnUserTypeBuildList", "vote", "CUserTypeVote", "GetUserTypeDescription", 200); UnRegisterModuleDependences("main", "OnBeforeProlog", "main", "", "", "/modules/vote/keepvoting.php"); UnRegisterModule("vote"); if ($this->errors !== false) { $APPLICATION->ThrowException(implode("<br>", $this->errors)); return false; } return true; }
function UnInstallDB($arParams = array()) { UnRegisterModuleDependences("main", "OnPrologAdminTitle", "storeassist", "CStoreAssist", "onPrologAdminTitle"); UnRegisterModuleDependences('main', 'OnBuildGlobalMenu', "storeassist", "CStoreAssist", "onBuildGlobalMenu"); CAgent::RemoveModuleAgents("storeassist"); UnRegisterModule("storeassist"); return true; }
public static function checkAgentIsAlive($name, $interval) { $name = '\\' . __CLASS__ . '::' . $name . ';'; $agent = \CAgent::GetList(array(), array('MODULE_ID' => 'tasks', 'NAME' => $name))->fetch(); if (!$agent['ID']) { \CAgent::AddAgent($name, 'tasks', 'N', $interval); } }
function UnInstallDB($arParams = array()) { global $DB, $APPLICATION; CAgent::RemoveModuleAgents('calendar'); $errors = null; if (true == array_key_exists("savedata", $arParams) && $arParams["savedata"] != 'Y') { $GLOBALS["USER_FIELD_MANAGER"]->OnEntityDelete("CALENDAR_EVENT"); $errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . '/bitrix/modules/' . $this->MODULE_ID . '/install/db/' . strtolower($DB->type) . '/uninstall.sql'); if (!empty($errors)) { $APPLICATION->ThrowException(implode("", $errors)); return false; } $this->UnInstallTasks(); } UnRegisterModuleDependences("pull", "OnGetDependentModule", "calendar", "CCalendarPullSchema", "OnGetDependentModule"); UnRegisterModuleDependences("im", "OnGetNotifySchema", "calendar", "CCalendarNotifySchema", "OnGetNotifySchema"); UnRegisterModuleDependences("im", "OnBeforeConfirmNotify", "calendar", "CCalendar", "HandleImCallback"); UnRegisterModuleDependences('intranet', 'OnPlannerInit', 'calendar', 'CCalendarEventHandlers', 'OnPlannerInit'); UnRegisterModuleDependences('intranet', 'OnPlannerAction', 'calendar', 'CCalendarEventHandlers', 'OnPlannerAction'); UnRegisterModuleDependences('rest', 'OnRestServiceBuildDescription', 'calendar', 'CCalendarRestService', 'OnRestServiceBuildDescription'); UnRegisterModuleDependences('socialnetwork', 'OnFillSocNetFeaturesList', 'calendar', 'CCalendarLiveFeed', 'AddEvent'); UnRegisterModuleDependences('socialnetwork', 'OnSonetLogEntryMenuCreate', 'calendar', 'CCalendarLiveFeed', 'OnSonetLogEntryMenuCreate'); UnRegisterModuleDependences('socialnetwork', 'OnAfterSonetLogEntryAddComment', 'calendar', 'CCalendarLiveFeed', 'OnAfterSonetLogEntryAddComment'); UnRegisterModuleDependences('socialnetwork', 'OnForumCommentIMNotify', 'calendar', 'CCalendarLiveFeed', 'OnForumCommentIMNotify'); UnRegisterModuleDependences('socialnetwork', 'onAfterCommentAddAfter', 'calendar', 'CCalendarLiveFeed', 'onAfterCommentAddAfter'); UnRegisterModuleDependences('socialnetwork', 'onAfterCommentUpdateAfter', 'calendar', 'CCalendarLiveFeed', 'onAfterCommentUpdateAfter'); RegisterModuleDependences('socialnetwork', 'OnSocNetGroupDelete', 'calendar', 'CCalendar', 'OnSocNetGroupDelete'); UnRegisterModuleDependences('search', 'BeforeIndex', 'calendar', 'CCalendarLiveFeed', 'FixForumCommentURL'); UnRegisterModuleDependences("main", "OnAfterRegisterModule", "main", "calendar", "InstallUserFields", "/modules/calendar/install/index.php"); // check webdav UF UnRegisterModule("calendar"); // Clear cache $arPath = array('access_tasks', 'type_list', 'section_list', 'attendees_list', 'event_list'); $cache = new CPHPCache(); foreach ($arPath as $path) { if ($path != '') { $cache->CleanDir("calendar/" . $path); } } // Remove tasks from LiveFeed if (IsModuleInstalled('socialnetwork') && CModule::IncludeModule('socialnetwork')) { $dbRes = CSocNetLog::GetList(array(), array("EVENT_ID" => "calendar"), false, false, array("ID")); if ($dbRes) { while ($arRes = $dbRes->Fetch()) { CSocNetLog::Delete($arRes["ID"]); } } } // Remove tasks from IM if (IsModuleInstalled('im') && CModule::IncludeModule('im')) { if (method_exists('CIMNotify', 'DeleteByModule')) { CIMNotify::DeleteByModule('calendar'); } } return true; }
public static function ensureAgentExists() { if (CTaskCountersProcessorInstaller::checkProcessIsNotActive()) { $agent = CAgent::GetList(array(), array('MODULE_ID' => 'tasks', 'NAME' => 'CTaskCountersProcessor::agent();'))->fetch(); if (!is_array($agent) || !isset($agent['ID'])) { CAgent::AddAgent('CTaskCountersProcessor::agent();', 'tasks', 'N', 900); // every 15 minutes } } }
public function deleteAgentIfExists($moduleName, $name) { /** @noinspection PhpDynamicAsStaticMethodCallInspection */ $aAgent = \CAgent::GetList(array("ID" => "DESC"), array('MODULE_ID' => $moduleName, 'NAME' => $name))->Fetch(); if (!$aAgent) { return false; } /** @noinspection PhpDynamicAsStaticMethodCallInspection */ \CAgent::RemoveAgent($name, $moduleName); return true; }
function UnInstallDB($arParams = array()) { global $DB; UnRegisterModuleDependences("perfmon", "OnGetTableSchema", "controller", "controller", "OnGetTableSchema"); CAgent::RemoveAgent('CControllerMember::UnregisterExpiredAgent();'); CAgent::RemoveAgent('CControllerAgent::CleanUp();'); if (!array_key_exists("savedata", $arParams) || $arParams["savedata"] != "Y") { if ($DB->Query("SELECT 'x' FROM b_controller_member", true)) { $errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/controller/install/db/" . strtolower($DB->type) . "/uninstall.sql"); } } UnRegisterModule("controller"); return true; }
private static function _addAgent() { global $APPLICATION; static $bAgentAdded = false; if (!$bAgentAdded) { $bAgentAdded = true; $rsAgents = CAgent::GetList(array("ID" => "DESC"), array("NAME" => "CPHPCacheFiles::DelayedDelete(%")); if (!$rsAgents->Fetch()) { $res = CAgent::AddAgent("CPHPCacheFiles::DelayedDelete();", "main", "Y", 1); if (!$res) { $APPLICATION->ResetException(); } } } }
private static function addAgent() { global $APPLICATION; static $bAgentAdded = false; if (!$bAgentAdded) { $bAgentAdded = true; $rsAgents = \CAgent::GetList(array("ID" => "DESC"), array("NAME" => "\\Bitrix\\Main\\Data\\CacheEngineFiles::delayedDelete(%")); if (!$rsAgents->Fetch()) { $res = \CAgent::AddAgent("\\Bitrix\\Main\\Data\\CacheEngineFiles::delayedDelete();", "main", "Y", 1); if (!$res) { $APPLICATION->ResetException(); } } } }
private static function _addAgent() { global $APPLICATION; static $bAgentAdded = false; if (!$bAgentAdded) { $bAgentAdded = true; $rsAgents = CAgent::GetList(array("ID" => "DESC"), array("NAME" => "CSearchStemTable::DelayedStemIndex(%")); if (!$rsAgents->Fetch()) { $res = CAgent::AddAgent("CSearchStemTable::DelayedStemIndex();", "search", "N", 1); if (!$res) { $APPLICATION->ResetException(); } } } }
function UnInstallDB($arParams = array()) { global $DB, $DBType, $APPLICATION; $this->errors = false; if (!array_key_exists("savedata", $arParams) || $arParams["savedata"] != "Y") { $this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/mail/install/db/" . strtolower($DB->type) . "/uninstall.sql"); } //delete agents CAgent::RemoveModuleAgents("mail"); UnRegisterModule("mail"); if ($this->errors !== false) { $APPLICATION->ThrowException(implode("<br>", $this->errors)); return false; } return true; }
function UnInstallDB($arParams = array()) { global $DB, $APPLICATION; CAgent::RemoveModuleAgents('calendar'); $errors = null; if (true == array_key_exists("savedata", $arParams) && $arParams["savedata"] != 'Y') { $errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . '/bitrix/modules/' . $this->MODULE_ID . '/install/db/' . strtolower($DB->type) . '/uninstall.sql'); if (!empty($errors)) { $APPLICATION->ThrowException(implode("", $errors)); return false; } $this->UnInstallTasks(); } UnRegisterModuleDependences("pull", "OnGetDependentModule", "calendar", "CCalendarPullSchema", "OnGetDependentModule"); UnRegisterModuleDependences("im", "OnGetNotifySchema", "calendar", "CCalendarNotifySchema", "OnGetNotifySchema"); UnRegisterModuleDependences("im", "OnBeforeConfirmNotify", "calendar", "CCalendar", "HandleImCallback"); UnRegisterModule("calendar"); return true; }
function __InTaskDeleteTask($delTaskId, $iblockId, $taskType, $ownerId, $arParams) { $delTaskId = IntVal($delTaskId); $iblockId = IntVal($iblockId); $ownerId = IntVal($ownerId); if ($delTaskId <= 0 || $iblockId <= 0 || $ownerId <= 0) { return ""; } $errorMessage = ""; if (StrLen($errorMessage) <= 0) { $sectionId = 0; $dbElementSections = CIBlockElement::GetElementGroups($delTaskId); while ($arElementSection = $dbElementSections->Fetch()) { if ($arElementSection["IBLOCK_ID"] == $iblockId) { $sectionId = $arElementSection["ID"]; break; } } if ($sectionId <= 0) { $errorMessage .= GetMessage("INTL_TASK_NOT_FOUND") . "."; } } if (StrLen($errorMessage) <= 0) { $dbSectionsChain = CIBlockSection::GetNavChain($iblockId, $sectionId); if ($arSect = $dbSectionsChain->GetNext()) { if ($taskType == 'group' && $arSect["XML_ID"] != $ownerId) { $errorMessage .= GetMessage("INTL_TASK_INTERNAL_ERROR") . " GTK003" . ". "; } elseif ($taskType != 'group' && $arSect["XML_ID"] != "users_tasks") { $errorMessage .= GetMessage("INTL_TASK_INTERNAL_ERROR") . " GTK004" . ". "; } } else { $errorMessage .= GetMessage("INTL_FOLDER_NOT_FOUND") . ". "; } } if (StrLen($errorMessage) <= 0) { if (!CIBlockElement::Delete($delTaskId)) { $errorMessage .= GetMessage("INTL_ERROR_DELETE_TASK") . ". "; } CAgent::RemoveAgent("CIntranetTasks::SendRemindEventAgent(" . $iblockId . ", " . $delTaskId . ", \"" . $arParams[$taskType == "user" ? "PATH_TO_USER_TASKS_TASK" : "PATH_TO_GROUP_TASKS_TASK"] . "\");", "intranet"); } return $errorMessage; }
public function replaceAgent($moduleName, $name, $interval, $nextExec) { /* @global $APPLICATION \CMain */ global $APPLICATION; /** @noinspection PhpDynamicAsStaticMethodCallInspection */ $aAgent = \CAgent::GetList(array("ID" => "DESC"), array('MODULE_ID' => $moduleName, 'NAME' => $name))->Fetch(); if ($aAgent) { /** @noinspection PhpDynamicAsStaticMethodCallInspection */ \CAgent::RemoveAgent($name, $moduleName); } /** @noinspection PhpDynamicAsStaticMethodCallInspection */ $agentId = \CAgent::AddAgent($name, $moduleName, 'N', $interval, '', 'Y', $nextExec); if ($agentId) { return $agentId; } if ($APPLICATION->GetException()) { $this->throwException(__METHOD__, $APPLICATION->GetException()->GetString()); } else { $this->throwException(__METHOD__, 'Agent %s not added', $name); } }
function Update($ID, $arFields) { global $DB; $ID = intval($ID); if (!$this->CheckFields("update", $arFields)) { return false; } unset($arFields["ID"]); $strUpdate = $DB->PrepareUpdate("b_xdi_lf_scheme", $arFields); if ($strUpdate != "") { $strSql = "UPDATE b_xdi_lf_scheme SET " . $strUpdate . " WHERE ID=" . $ID; $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__); if (defined("BX_COMP_MANAGED_CACHE")) { $GLOBALS["CACHE_MANAGER"]->ClearByTag("XDI_SCHEME_" . $ID); } if ($ID > 0 && $arFields["ACTIVE"] == "Y" && $arFields["AUTO"] == "Y") { CAgent::AddAgent("CXDILFScheme::CheckRequest();", "xdimport", "N", COption::GetOptionString("xdimport", "xdi_lf_checkrequest_interval", 300)); } } return $ID; }
public static function SendEvent($ID, $mailTemplate = "SONET_NEW_EVENT", $tmp_id = false, $bAgent = false, $bTransport = false) { $ID = IntVal($ID); if ($ID <= 0) return false; if (intval($tmp_id) > 0) $arFilter = array("ID" => $tmp_id); else $arFilter = array("ID" => $ID); $dbLog = CSocNetLog::GetList( array(), $arFilter, false, false, array("ID", "ENTITY_TYPE", "ENTITY_ID", "USER_ID", "USER_NAME", "USER_LAST_NAME", "USER_SECOND_NAME", "USER_LOGIN", "EVENT_ID", "LOG_DATE", "TITLE_TEMPLATE", "TITLE", "MESSAGE", "TEXT_MESSAGE", "URL", "MODULE_ID", "CALLBACK_FUNC", "SITE_ID", "PARAMS", "SOURCE_ID", "GROUP_NAME", "CREATED_BY_NAME", "CREATED_BY_SECOND_NAME", "CREATED_BY_LAST_NAME", "CREATED_BY_LOGIN", "LOG_SOURCE_ID"), array("MIN_ID_JOIN" => true) ); $arLog = $dbLog->Fetch(); if (!$arLog) return $bAgent; if (MakeTimeStamp($arLog["LOG_DATE"]) > (time() + CTimeZone::GetOffset())) { $agent = "CSocNetLog::SendEventAgent(".$ID.", '".$mailTemplate."', ".($tmp_id ? $tmp_id : 'false').");"; $rsAgents = CAgent::GetList(array("ID"=>"DESC"), array("NAME" => $agent)); if(!$rsAgents->Fetch()) { $res = CAgent::AddAgent($agent, "socialnetwork", "N", 0, $arLog["LOG_DATE"], "Y", $arLog["LOG_DATE"]); if(!$res) $GLOBALS["APPLICATION"]->ResetException(); } elseif ($bAgent) { CAgent::RemoveAgent($agent, "socialnetwork"); CAgent::AddAgent($agent, "socialnetwork", "N", 0, $arLog["LOG_DATE"], "Y", $arLog["LOG_DATE"]); return true; } return false; } $arEvent = CSocNetLogTools::FindLogEventByID($arLog["EVENT_ID"], $arLog["ENTITY_TYPE"]); if ( $arEvent && array_key_exists("CLASS_FORMAT", $arEvent) && array_key_exists("METHOD_FORMAT", $arEvent) ) { $dbSiteCurrent = CSite::GetByID(SITE_ID); if ($arSiteCurrent = $dbSiteCurrent->Fetch()) if ($arSiteCurrent["LANGUAGE_ID"] != LANGUAGE_ID) $arLog["MAIL_LANGUAGE_ID"] = $arSiteCurrent["LANGUAGE_ID"]; $arLog["FIELDS_FORMATTED"] = call_user_func(array($arEvent["CLASS_FORMAT"], $arEvent["METHOD_FORMAT"]), $arLog, array(), true); } if ( array_key_exists($arLog["ENTITY_TYPE"], $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"]) && array_key_exists("HAS_MY", $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]]) && $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]]["HAS_MY"] == "Y" && array_key_exists("CLASS_OF", $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]]) && array_key_exists("METHOD_OF", $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]]) && strlen($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]]["CLASS_OF"]) > 0 && strlen($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]]["METHOD_OF"]) > 0 && method_exists($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]]["CLASS_OF"], $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]]["METHOD_OF"]) ) $arOfEntities = call_user_func(array($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]]["CLASS_OF"], $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]]["METHOD_OF"]), $arLog["ENTITY_ID"]); if ($bTransport) { $arListParams = array( "USE_SUBSCRIBE" => "Y", "ENTITY_TYPE" => $arLog["ENTITY_TYPE"], "ENTITY_ID" => $arLog["ENTITY_ID"], "EVENT_ID" => $arLog["EVENT_ID"], "USER_ID" => $arLog["USER_ID"], "OF_ENTITIES" => $arOfEntities, "TRANSPORT" => array("M", "X") ); $arLogSites = array(); $rsLogSite = CSocNetLog::GetSite($ID); while($arLogSite = $rsLogSite->Fetch()) $arLogSites[] = $arLogSite["LID"]; if (CModule::IncludeModule("extranet")) { $arSites = array(); $dbSite = CSite::GetList($by="sort", $order="desc", array("ACTIVE" => "Y")); while($arSite = $dbSite->Fetch()) $arSites[$arSite["ID"]] = array( "DIR" => (strlen(trim($arSite["DIR"])) > 0 ? $arSite["DIR"] : "/"), "SERVER_NAME" => (strlen(trim($arSite["SERVER_NAME"])) > 0 ? $arSite["SERVER_NAME"] : COption::GetOptionString("main", "server_name", $_SERVER["HTTP_HOST"])) ); $extranet_site_id = CExtranet::GetExtranetSiteID(); $intranet_site_id = CSite::GetDefSite(); $arIntranetUsers = CExtranet::GetIntranetUsers(); } $dbSubscribers = CSocNetLogEvents::GetList( array("TRANSPORT" => "DESC"), array( "USER_ACTIVE" => "Y", "SITE_ID" => array_merge($arLogSites, array(false)) ), false, false, array("USER_ID", "SITE_ID", "ENTITY_TYPE", "ENTITY_ID", "ENTITY_CB", "ENTITY_MY", "USER_NAME", "USER_LAST_NAME", "USER_LOGIN", "USER_LID", "USER_EMAIL", "TRANSPORT"), $arListParams ); $arListParams = array( "USE_SUBSCRIBE" => "Y", "ENTITY_TYPE" => $arLog["ENTITY_TYPE"], "ENTITY_ID" => $arLog["ENTITY_ID"], "EVENT_ID" => $arLog["EVENT_ID"], "USER_ID" => $arLog["USER_ID"], "OF_ENTITIES" => $arOfEntities, "TRANSPORT" => "N" ); $dbUnSubscribers = CSocNetLogEvents::GetList( array("TRANSPORT" => "DESC"), array( "USER_ACTIVE" => "Y", "SITE_ID" => array_merge($arLogSites, array(false)) ), false, false, array("USER_ID", "SITE_ID", "ENTITY_TYPE", "ENTITY_ID", "ENTITY_CB", "ENTITY_MY", "TRANSPORT", "EVENT_ID"), $arListParams ); $arUnSubscribers = array(); while ($arUnSubscriber = $dbUnSubscribers->Fetch()) $arUnSubscribers[] = $arUnSubscriber["USER_ID"]."_".$arUnSubscriber["ENTITY_TYPE"]."_".$arUnSubscriber["ENTITY_ID"]."_".$arUnSubscriber["ENTITY_MY"]."_".$arUnSubscriber["ENTITY_CB"]."_".$arUnSubscriber["EVENT_ID"]; $bHasAccessAll = CSocNetLogRights::CheckForUserAll($arLog["ID"]); $arSentUserID = array("M" => array(), "X" => array()); while ($arSubscriber = $dbSubscribers->Fetch()) { if ( is_array($arIntranetUsers) && !in_array($arSubscriber["USER_ID"], $arIntranetUsers) && !in_array($extranet_site_id, $arLogSites) ) continue; if ( array_key_exists($arSubscriber["TRANSPORT"], $arSentUserID) && in_array($arSubscriber["USER_ID"], $arSentUserID[$arSubscriber["TRANSPORT"]]) ) continue; if ( intval($arSubscriber["ENTITY_ID"]) != 0 && $arSubscriber["EVENT_ID"] == "all" && ( in_array($arSubscriber["USER_ID"]."_".$arSubscriber["ENTITY_TYPE"]."_".$arSubscriber["ENTITY_ID"]."_N_".$arSubscriber["ENTITY_CB"]."_".$arLog["EVENT_ID"], $arUnSubscribers) || in_array($arSubscriber["USER_ID"]."_".$arSubscriber["ENTITY_TYPE"]."_".$arSubscriber["ENTITY_ID"]."_Y_".$arSubscriber["ENTITY_CB"]."_".$arLog["EVENT_ID"], $arUnSubscribers) ) ) continue; elseif ( intval($arSubscriber["ENTITY_ID"]) == 0 && $arSubscriber["ENTITY_CB"] == "N" && $arSubscriber["EVENT_ID"] != "all" && ( in_array($arSubscriber["USER_ID"]."_".$arSubscriber["ENTITY_TYPE"]."_".$arLog["ENTITY_ID"]."_Y_N_all", $arUnSubscribers) || in_array($arSubscriber["USER_ID"]."_".$arSubscriber["ENTITY_TYPE"]."_".$arLog["ENTITY_ID"]."_N_N_all", $arUnSubscribers) || in_array($arSubscriber["USER_ID"]."_".$arSubscriber["ENTITY_TYPE"]."_".$arLog["ENTITY_ID"]."_Y_N_".$arLog["EVENT_ID"], $arUnSubscribers) || in_array($arSubscriber["USER_ID"]."_".$arSubscriber["ENTITY_TYPE"]."_".$arLog["ENTITY_ID"]."_N_N_".$arLog["EVENT_ID"], $arUnSubscribers) ) ) continue; $arSentUserID[$arSubscriber["TRANSPORT"]][] = $arSubscriber["USER_ID"]; if (!$bHasAccessAll) { $bHasAccess = CSocNetLogRights::CheckForUserOnly($arLog["ID"], $arSubscriber["USER_ID"]); if (!$bHasAccess) continue; } if (CModule::IncludeModule("extranet")) { $server_name = $arSites[((!in_array($arSubscriber["USER_ID"], $arIntranetUsers) && $extranet_site_id) ? $extranet_site_id : $intranet_site_id)]["SERVER_NAME"]; $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL_TO_SEND"] = str_replace( array("#SERVER_NAME#", "#GROUPS_PATH#"), array( $server_name, COption::GetOptionString("socialnetwork", "workgroups_page", false, ((!in_array($arSubscriber["USER_ID"], $arIntranetUsers) && $extranet_site_id) ? $extranet_site_id : $intranet_site_id)) ), $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL"] ); $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE_TO_SEND"] = str_replace( array("#SERVER_NAME#", "#GROUPS_PATH#"), array( $server_name, COption::GetOptionString("socialnetwork", "workgroups_page", false, ((!in_array($arSubscriber["USER_ID"], $arIntranetUsers) && $extranet_site_id) ? $extranet_site_id : $intranet_site_id)) ), $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"] ); } else $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE_TO_SEND"] = $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"]; switch ($arSubscriber["TRANSPORT"]) { case "X": if ( array_key_exists("URL_TO_SEND", $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && strlen($arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL_TO_SEND"]) > 0 ) $link = GetMessage("SONET_GL_SEND_EVENT_LINK").$arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL_TO_SEND"]; elseif ( array_key_exists("URL", $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && strlen($arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL"]) > 0 ) $link = GetMessage("SONET_GL_SEND_EVENT_LINK").$arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL"]; else $link = ""; $arMessageFields = array( "FROM_USER_ID" => (intval($arLog["USER_ID"]) > 0 ? $arLog["USER_ID"] : 1), "TO_USER_ID" => $arSubscriber["USER_ID"], "MESSAGE" => $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["TITLE"]." #BR#".$arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE_TO_SEND"].(strlen($link) > 0 ? "#BR# ".$link : ""), "=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "MESSAGE_TYPE" => SONET_MESSAGE_SYSTEM, "IS_LOG" => "Y" ); CSocNetMessages::Add($arMessageFields); break; case "M": $arFields["SUBSCRIBER_ID"] = $arSubscriber["USER_ID"]; $arFields["SUBSCRIBER_NAME"] = $arSubscriber["USER_NAME"]; $arFields["SUBSCRIBER_LAST_NAME"] = $arSubscriber["USER_LAST_NAME"]; $arFields["SUBSCRIBER_LOGIN"] = $arSubscriber["USER_LOGIN"]; $arFields["SUBSCRIBER_EMAIL"] = $arSubscriber["USER_EMAIL"]; $arFields["EMAIL_TO"] = $arSubscriber["USER_EMAIL"]; $arFields["TITLE"] = str_replace("#BR#", "\n", $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["TITLE"]); $arFields["MESSAGE"] = str_replace("#BR#", "\n", $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE_TO_SEND"]); $arFields["ENTITY"] = $arLog["FIELDS_FORMATTED"]["ENTITY"]["FORMATTED"]; $arFields["ENTITY_TYPE"] = $arLog["FIELDS_FORMATTED"]["ENTITY"]["TYPE_MAIL"]; if ( array_key_exists("URL_TO_SEND", $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && strlen($arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL_TO_SEND"]) > 0 ) $arFields["URL"] = $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL_TO_SEND"]; elseif ( array_key_exists("URL", $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && strlen($arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL"]) > 0 ) $arFields["URL"] = $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL"]; else $arFields["URL"] = $arLog["URL"]; if (CModule::IncludeModule("extranet")) $arUserGroup = CUser::GetUserGroup($arSubscriber["USER_ID"]); foreach ($arLogSites as $site_id_tmp) { if (IsModuleInstalled("extranet")) { if ( ( CExtranet::IsExtranetSite($site_id_tmp) && in_array(CExtranet::GetExtranetUserGroupID(), $arUserGroup) ) || ( !CExtranet::IsExtranetSite($site_id_tmp) && !in_array(CExtranet::GetExtranetUserGroupID(), $arUserGroup) ) ) { $siteID = $site_id_tmp; break; } else continue; } else { $siteID = $site_id_tmp; break; } } if (!$siteID) $siteID = (defined("SITE_ID") ? SITE_ID : $arSubscriber["SITE_ID"]); if (StrLen($siteID) <= 0) $siteID = $arSubscriber["USER_LID"]; if (StrLen($siteID) <= 0) continue; $event = new CEvent; $event->Send($mailTemplate, $siteID, $arFields, "N"); break; default: } } } CSocNetLog::CounterIncrement($arLog["ID"], $arLog["EVENT_ID"], $arOfEntities); return true; }
function UnInstallDB() { //delete agents CAgent::RemoveModuleAgents("webdav"); COption::RemoveOption('webdav'); $this->UnInstallTasks(); UnRegisterModuleDependences('main', 'OnUserTypeBuildList', 'webdav', 'CUserTypeWebdavElement', 'GetUserTypeDescription'); UnRegisterModuleDependences('blog', 'OnPostAdd', 'webdav', 'CUserTypeWebdavElement', 'OnPostAdd'); UnRegisterModuleDependences('blog', 'OnPostUpdate', 'webdav', 'CUserTypeWebdavElement', 'OnPostUpdate'); UnRegisterModuleDependences('blog', 'OnBeforePostDelete', 'webdav', 'CUserTypeWebdavElement', 'OnBeforePostDelete'); UnRegisterModuleDependences("blog", "OnCommentAdd", 'webdav', 'CUserTypeWebdavElement', "OnCommentAdd"); UnRegisterModuleDependences("blog", "OnCommentUpdate", 'webdav', 'CUserTypeWebdavElement', "OnCommentUpdate"); UnRegisterModuleDependences("blog", "OnBeforeCommentDelete", 'webdav', 'CUserTypeWebdavElement', "OnBeforeCommentDelete"); UnRegisterModuleDependences("blog", "OnCommentAdd", 'webdav', 'CUserTypeWebdavElementHistory', "OnCommentAdd"); UnRegisterModuleDependences("blog", "OnCommentUpdate", 'webdav', 'CUserTypeWebdavElementHistory', "OnCommentUpdate"); UnRegisterModuleDependences("blog", "OnBeforeCommentDelete", 'webdav', 'CUserTypeWebdavElementHistory', "OnBeforeCommentDelete"); //UnRegisterModuleDependences('socialnetwork', 'OnSocNetFeaturesAdd', 'webdav', 'CIBlockWebdavSocnet', 'OnSocNetFeaturesAdd'); //UnRegisterModuleDependences('socialnetwork', 'OnSocNetFeaturesUpdate', 'webdav', 'CIBlockWebdavSocnet', 'OnSocNetFeaturesUpdate'); //UnRegisterModuleDependences('socialnetwork', 'OnSocNetFeatures', 'webdav', 'CIBlockWebdavSocnet', 'OnSocNetFeatures'); //UnRegisterModuleDependences('socialnetwork', 'OnSocNetUserToGroupAdd', 'webdav', 'CIBlockWebdavSocnet', 'OnSocNetUserToGroupAdd'); //UnRegisterModuleDependences('socialnetwork', 'OnSocNetUserToGroupUpdate', 'webdav', 'CIBlockWebdavSocnet', 'OnSocNetUserToGroupUpdate'); //UnRegisterModuleDependences('socialnetwork', 'OnSocNetUserToGroupDelete', 'webdav', 'CIBlockWebdavSocnet', 'OnSocNetUserToGroupDelete'); //UnRegisterModuleDependences('socialnetwork', 'OnSocNetGroupDelete', 'webdav', 'CIBlockWebdavSocnet', 'OnSocNetGroupDelete'); //UnRegisterModuleDependences('socialnetwork', 'OnSocNetGroupAdd', 'webdav', 'CIBlockWebdavSocnet', 'OnSocNetGroupAdd'); //UnRegisterModuleDependences('socialnetwork', 'OnSocNetGroupUpdate', 'webdav', 'CIBlockWebdavSocnet', 'OnSocNetGroupUpdate'); UnRegisterModuleDependences("bizproc", "OnAddToHistory", "webdav", "CIBlockDocumentWebdav", "OnAddToHistory"); UnRegisterModuleDependences("main", "OnBeforeProlog", "webdav", "CWebDavBase", "OnBeforeProlog"); // from old version UnRegisterModuleDependences("main", "OnBeforeProlog", "main", "", "", "/modules/webdav/prolog_before.php"); UnRegisterModuleDependences("search", "BeforeIndex", "webdav", "CRatingsComponentsWebDav", "BeforeIndex"); UnRegisterModuleDependences("main", "OnEventLogGetAuditTypes", "webdav", "CEventWebDav", "GetAuditTypes"); UnRegisterModuleDependences("main", "OnEventLogGetAuditHandlers", "webdav", "CEventWebDav", "MakeWebDavObject"); UnRegisterModuleDependences("socialnetwork", "OnFillSocNetAllowedSubscribeEntityTypes", "webdav", "CWebDavSocNetEvent", "OnFillSocNetAllowedSubscribeEntityTypes"); UnRegisterModuleDependences("socialnetwork", "OnFillSocNetLogEvents", "webdav", "CWebDavSocNetEvent", "OnFillSocNetLogEvents"); UnRegisterModuleDependences("iblock", "OnAfterIBlockElementDelete", "webdav", "CIBlockDocumentWebdav", "OnAfterIBlockElementDelete"); UnRegisterModuleDependences("im", "OnBeforeConfirmNotify", "webdav", "CWebDavSymlinkHelper", "OnBeforeConfirmNotify"); UnRegisterModule("webdav"); $this->InstallUnInstallDBTables(false); return true; }
function UnInstallDB($arParams = array()) { global $DB, $DBType, $APPLICATION; $this->errors = false; if (array_key_exists("savedata", $arParams) && $arParams["savedata"] != "Y") { $this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/install/db/" . $DBType . "/uninstall.sql"); if ($this->errors !== false) { $APPLICATION->ThrowException(implode("", $this->errors)); return false; } } UnRegisterModuleDependences("catalog", "OnSaleOrderSumm", "sale", "CSaleOrder", "__SaleOrderCount"); UnRegisterModuleDependences("main", "OnBeforeProlog", "main", "", "", "/modules/sale/affiliate.php"); UnRegisterModuleDependences("main", "OnUserLogin", "sale", "CSaleUser", "OnUserLogin"); UnRegisterModuleDependences("main", "OnBeforeLangDelete", "sale", "CSalePersonType", "OnBeforeLangDelete"); UnRegisterModuleDependences("main", "OnLanguageDelete", "sale", "CSaleLocation", "OnLangDelete"); UnRegisterModuleDependences("main", "OnLanguageDelete", "sale", "CSaleLocationGroup", "OnLangDelete"); UnRegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleOrderUserProps", "OnUserDelete"); UnRegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleUserAccount", "OnUserDelete"); UnRegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleAuxiliary", "OnUserDelete"); UnRegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleUser", "OnUserDelete"); UnRegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleRecurring", "OnUserDelete"); UnRegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleUserCards", "OnUserDelete"); UnRegisterModuleDependences("main", "OnBeforeUserDelete", "sale", "CSaleOrder", "OnBeforeUserDelete"); UnRegisterModuleDependences("main", "OnBeforeUserDelete", "sale", "CSaleAffiliate", "OnBeforeUserDelete"); UnRegisterModuleDependences("main", "OnBeforeUserDelete", "sale", "CSaleUserAccount", "OnBeforeUserDelete"); UnRegisterModuleDependences("currency", "OnBeforeCurrencyDelete", "sale", "CSaleOrder", "OnBeforeCurrencyDelete"); UnRegisterModuleDependences("currency", "OnBeforeCurrencyDelete", "sale", "CSaleLang", "OnBeforeCurrencyDelete"); UnRegisterModuleDependences("currency", "OnModuleUnInstall", "sale", "", "CurrencyModuleUnInstallSale"); UnRegisterModuleDependences("mobileapp", "OnBeforeAdminMobileMenuBuild", "sale", "CSaleMobileOrderUtils", "buildSaleAdminMobileMenu"); UnRegisterModuleDependences("sender", "OnConnectorList", "sale", "\\Bitrix\\Sale\\SenderEventHandler", "onConnectorListBuyer"); UnRegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlGroup", "GetControlDescr"); UnRegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlBasketGroup", "GetControlDescr"); UnRegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlBasketFields", "GetControlDescr"); UnRegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlBasketProps", "GetControlDescr"); UnRegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlOrderFields", "GetControlDescr"); UnRegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlCommon", "GetControlDescr"); UnRegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlGroup", "GetControlDescr"); UnRegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlDelivery", "GetControlDescr"); UnRegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlBasketGroup", "GetControlDescr"); UnRegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlSubGroup", "GetControlDescr"); UnRegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCondCtrlBasketFields", "GetControlDescr"); UnRegisterModuleDependences("sale", "OnOrderDelete", "sale", "CSaleMobileOrderPull", "onOrderDelete"); UnRegisterModuleDependences("sale", "OnOrderAdd", "sale", "CSaleMobileOrderPull", "onOrderAdd"); UnRegisterModuleDependences("sale", "OnOrderUpdate", "sale", "CSaleMobileOrderPull", "onOrderUpdate"); UnRegisterModuleDependences("sale", "OnSaleStatusOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleStatusOrderHandler"); UnRegisterModuleDependences("sale", "OnSaleDeliveryOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleDeliveryOrderHandler"); UnRegisterModuleDependences("sale", "OnSaleDeductOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleDeductOrderHandler"); UnRegisterModuleDependences("sale", "OnSaleCancelOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleCancelOrderHandler"); UnRegisterModuleDependences("sale", "OnSalePayOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSalePayOrderHandler"); UnRegisterModuleDependences("main", "OnEventLogGetAuditTypes", "sale", "CSaleYMHandler", 'OnEventLogGetAuditTypes'); UnRegisterModuleDependences("main", "OnEventLogGetAuditTypes", "sale", "CSalePaySystemAction", 'OnEventLogGetAuditTypes'); $eventManager = \Bitrix\Main\EventManager::getInstance(); $eventManager->unRegisterEventHandler('main', 'OnUserLogout', 'sale', '\\Bitrix\\Sale\\DiscountCouponsManager', 'logout'); CAgent::RemoveModuleAgents("sale"); ModuleManager::unRegisterModule('sale'); return true; }