本文整理汇总了PHP中CAgent::AddAgent方法的典型用法代码示例。如果您正苦于以下问题:PHP CAgent::AddAgent方法的具体用法?PHP CAgent::AddAgent怎么用?PHP CAgent::AddAgent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAgent
的用法示例。
在下文中一共展示了CAgent::AddAgent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actualizeAgent
/**
* @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);
}
}
}
示例2: InstallDB
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;
}
}
示例3: InstallDB
function InstallDB()
{
global $APPLICATION, $DB, $errors;
if (!$DB->Query("SELECT 'x' FROM b_adv_banner", true)) {
$EMPTY = "Y";
} else {
$EMPTY = "N";
}
if ($EMPTY == "Y") {
$errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/advertising/install/db/" . strtolower($DB->type) . "/install.sql");
if (!empty($errors)) {
$APPLICATION->ThrowException(implode("", $errors));
return false;
}
}
RegisterModule("advertising");
RegisterModuleDependences("main", "OnBeforeProlog", "advertising");
RegisterModuleDependences("main", "OnEndBufferContent", "advertising", "CAdvBanner", "FixShowAll");
RegisterModuleDependences("main", "OnBeforeRestartBuffer", "advertising", "CAdvBanner", "BeforeRestartBuffer");
CAgent::AddAgent("CAdvContract::SendInfo();", "advertising", "N", 7200);
CAgent::AddAgent("CAdvBanner::CleanUpDynamics();", "advertising", "N", 86400);
if ($EMPTY == "Y") {
CModule::IncludeModule('advertising');
$arSites = array();
$rs = CSite::GetList($b = "sort", $o = "asc");
while ($ar = $rs->Fetch()) {
$arSites[] = $ar['ID'];
}
$ac = new CAdvContract();
$arFields = array('ACTIVE' => 'Y', 'NAME' => 'Default', 'SORT' => 10000, 'DESCRIPTION' => 'all site without any restrictions', 'EMAIL_COUNT' => 1, 'arrTYPE' => array('ALL'), 'arrWEEKDAY' => array('MONDAY' => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), 'SATURDAY' => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), 'SUNDAY' => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), 'THURSDAY' => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), 'TUESDAY' => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), 'WEDNESDAY' => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), 'FRIDAY' => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23)), 'arrSITE' => $arSites);
$ac->Set($arFields, 0, 'N');
}
return true;
}
示例4: InstallDB
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;
}
示例5: CheckExpireAgent
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;
}
示例6: SubscribeOnTime
public function SubscribeOnTime($workflowId, $eventName, $expiresAt)
{
CTimeZone::Disable();
$result = CAgent::AddAgent("CBPSchedulerService::OnAgent('" . $workflowId . "', '" . $eventName . "', array('SchedulerService' => 'OnAgent'));", "bizproc", "N", 10, "", "Y", date($GLOBALS["DB"]->DateFormatToPHP(FORMAT_DATETIME), $expiresAt));
CTimeZone::Enable();
return $result;
}
示例7: InstallDB
function InstallDB($arParams = array())
{
global $DB, $APPLICATION;
$EMPTY = false;
$errors = false;
if (!$DB->Query("SELECT 'x' FROM b_ticket", true)) {
$EMPTY = true;
}
if ($EMPTY) {
$errors = $DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/support/install/db/' . strtolower($DB->type) . '/install.sql');
}
if (is_array($errors)) {
$APPLICATION->ThrowException(implode(' ', $errors));
return false;
}
RegisterModule('support');
RegisterModuleDependences('mail', 'OnGetFilterList', 'support', 'CSupportEMail', 'OnGetFilterList');
CAgent::RemoveModuleAgents("support");
CAgent::AddAgent("CTicketReminder::AgentFunction();", "support", "N", 60);
CAgent::AddAgent('CTicket::CleanUpOnline();', 'support', 'N');
CAgent::AddAgent('CTicket::AutoClose();', 'support', 'N');
if ($EMPTY) {
if ($arParams['admin'] == 'Y') {
$this->InstallEvents();
}
if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/support/install/demodata.php')) {
$DD_ERROR = false;
include $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/support/install/demodata.php';
if ($DD_ERROR) {
return false;
}
}
}
return true;
}
示例8: InstallDB
function InstallDB()
{
global $DB, $APPLICATION;
$this->errors = false;
if (!$DB->Query("SELECT 'x' FROM b_im_chat", true)) {
$this->errors = $DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/im/install/db/" . strtolower($DB->type) . "/install.sql");
}
if ($this->errors !== false) {
$APPLICATION->ThrowException(implode("", $this->errors));
return false;
}
RegisterModule("im");
RegisterModuleDependences('main', 'OnAddRatingVote', 'im', 'CIMEvent', 'OnAddRatingVote');
RegisterModuleDependences('main', 'OnCancelRatingVote', 'im', 'CIMEvent', 'OnCancelRatingVote');
RegisterModuleDependences('main', 'OnAfterUserUpdate', 'im', 'CIMEvent', 'OnAfterUserUpdate');
RegisterModuleDependences('main', 'OnUserDelete', 'im', 'CIMEvent', 'OnUserDelete');
RegisterModuleDependences("pull", "OnGetDependentModule", "im", "CIMEvent", "OnGetDependentModule");
RegisterModuleDependences("main", "OnProlog", "main", "", "", 3, "/modules/im/ajax_hit.php");
RegisterModuleDependences("perfmon", "OnGetTableSchema", "im", "CIMTableSchema", "OnGetTableSchema");
RegisterModuleDependences("im", "OnGetNotifySchema", "im", "CIMNotifySchema", "OnGetNotifySchema");
RegisterModuleDependences("main", "OnFileDelete", "im", "CIMEvent", "OnFileDelete");
RegisterModuleDependences("main", "OnApplicationsBuildList", "im", "DesktopApplication", "OnApplicationsBuildList");
CAgent::AddAgent("CIMMail::MailNotifyAgent();", "im", "N", 600);
CAgent::AddAgent("CIMMail::MailMessageAgent();", "im", "N", 600);
CAgent::AddAgent("CIMDisk::RemoveTmpFileAgent();", "im", "N", 43200);
CModule::IncludeModule("im");
if (CIMConvert::ConvertCount() > 0) {
Cmodule::IncludeModule("im");
CAdminNotify::Add(array("MESSAGE" => GetMessage("IM_CONVERT_MESSAGE", array("#A_TAG_START#" => '<a href="/bitrix/admin/im_convert.php?lang=' . LANGUAGE_ID . '">', "#A_TAG_END#" => "</a>")), "TAG" => "IM_CONVERT", "MODULE_ID" => "IM", "ENABLE_CLOSE" => "Y"));
CAgent::AddAgent("CIMConvert::UndeliveredMessageAgent();", "im", "N", 20, "", "Y", ConvertTimeStamp(time() + CTimeZone::GetOffset() + 20, "FULL"));
}
return true;
}
示例9: InstallDB
function InstallDB($arParams = array())
{
global $DB, $DBType, $APPLICATION;
$this->errors = false;
// Database tables creation
if(!$DB->Query("SELECT 'x' FROM b_mail_mailbox WHERE 1=0", true))
{
$this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/mail/install/db/".strtolower($DB->type)."/install.sql");
}
if($this->errors !== false)
{
$APPLICATION->ThrowException(implode("<br>", $this->errors));
return false;
}
else
{
RegisterModule("mail");
CModule::IncludeModule("mail");
CAgent::AddAgent("CMailbox::CleanUp();", "mail", "N", 60*60*24);
return true;
}
}
示例10: InstallDB
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;
}
示例11: AgentRun
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;
}
示例12: InstallDB
function InstallDB($arParams = array())
{
global $DB, $DBType, $APPLICATION;
$this->errors = false;
// Database tables creation
if (!$DB->Query("SELECT 'x' FROM b_sender_contact WHERE 1=0", true)) {
$this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sender/install/db/" . $DBType . "/install.sql");
}
if ($this->errors !== false) {
$APPLICATION->ThrowException(implode("<br>", $this->errors));
return false;
} else {
RegisterModule("sender");
CModule::IncludeModule("sender");
// read and click notifications
RegisterModuleDependences("main", "OnMailEventMailRead", "sender", "bitrix\\sender\\postingmanager", "onMailEventMailRead");
RegisterModuleDependences("main", "OnMailEventMailClick", "sender", "bitrix\\sender\\postingmanager", "onMailEventMailClick");
// unsubscription notifications
RegisterModuleDependences("main", "OnMailEventSubscriptionDisable", "sender", "Bitrix\\Sender\\Subscription", "onMailEventSubscriptionDisable");
RegisterModuleDependences("main", "OnMailEventSubscriptionEnable", "sender", "Bitrix\\Sender\\Subscription", "onMailEventSubscriptionEnable");
RegisterModuleDependences("main", "OnMailEventSubscriptionList", "sender", "Bitrix\\Sender\\Subscription", "onMailEventSubscriptionList");
// connectors of module sender
RegisterModuleDependences("sender", "OnConnectorList", "sender", "bitrix\\sender\\connectormanager", "onConnectorListContact");
RegisterModuleDependences("sender", "OnConnectorList", "sender", "bitrix\\sender\\connectormanager", "onConnectorListRecipient");
// mail templates and blocks
RegisterModuleDependences("sender", "OnPresetTemplateList", "sender", "Bitrix\\Sender\\Preset\\TemplateBase", "onPresetTemplateList");
RegisterModuleDependences("sender", "OnPresetTemplateList", "sender", "Bitrix\\Sender\\TemplateTable", "onPresetTemplateList");
RegisterModuleDependences("sender", "OnPresetMailBlockList", "sender", "Bitrix\\Sender\\Preset\\MailBlockBase", "OnPresetMailBlockList");
CTimeZone::Disable();
\Bitrix\Sender\MailingManager::actualizeAgent();
CAgent::AddAgent(\Bitrix\Sender\MailingManager::getAgentNamePeriod(), "sender", "N", COption::GetOptionString("sender", "reiterate_interval"));
CTimeZone::Enable();
return true;
}
}
示例13: checkAgentIsAlive
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);
}
}
示例14: ensureAgentExists
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
}
}
}
示例15: InstallDB
function InstallDB()
{
RegisterModule("storeassist");
RegisterModuleDependences("main", "OnPrologAdminTitle", "storeassist", "CStoreAssist", "onPrologAdminTitle");
RegisterModuleDependences('main', 'OnBuildGlobalMenu', "storeassist", "CStoreAssist", "onBuildGlobalMenu");
$dateCheckTs = MakeTimeStamp(date("d", time() + 3600 * 24) . "." . date("m", time() + 3600 * 24) . "." . date("Y", time() + 3600 * 24) . " 00:00:00", "DD.MM.YYYY HH:MI:SS");
$dateCheck = ConvertTimeStamp($dateCheckTs, "FULL");
CAgent::AddAgent("CStoreAssist::AgentCountDayOrders();", "storeassist", "N", 86400, $dateCheck, "Y", $dateCheck);
return true;
}