当前位置: 首页>>代码示例>>PHP>>正文


PHP CAgent::Update方法代码示例

本文整理汇总了PHP中CAgent::Update方法的典型用法代码示例。如果您正苦于以下问题:PHP CAgent::Update方法的具体用法?PHP CAgent::Update怎么用?PHP CAgent::Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CAgent的用法示例。


在下文中一共展示了CAgent::Update方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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;
 }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:27,代码来源:gmexport.php

示例2: AddAgent

 public static function AddAgent($profileID, $setup)
 {
     COption::SetOptionString("main", "agents_use_crontab", "Y");
     $agent_ID = 0;
     $agent_period = intval($setup["PERIOD"]) * 60;
     if ($agent_period <= 0) {
         $agent_period = 86400;
     }
     $setupDateStamp = MakeTimeStamp($setup["DAT_START"]);
     $currentDateStamp = time() + 120;
     $runTime = date("d.m.Y H:i", $setupDateStamp < $currentDateStamp ? $currentDateStamp : $setupDateStamp);
     if ($profileID > 0) {
         $arAgent = CAgent::GetList(array(), array("NAME" => "CExportproAgent::StartExport(" . $profileID . ");"))->Fetch();
         if (!$arAgent) {
             $agent_ID = CAgent::AddAgent("CExportproAgent::StartExport(" . $profileID . ");", "acrit.exportpro", "N", $agent_period, "", "Y", $runTime);
         } elseif ($arAgent) {
             $agent_ID = $arAgent["ID"];
             $agentNextStart = MakeTimeStamp($arAgent["NEXT_EXEC"]);
             if ($agentNextStart == $setupDateStamp && $agentNextStart > $currentDateStamp) {
                 $runTime = date("d.m.Y H:i", $agentNextStart);
             }
             CAgent::Update($arAgent["ID"], array("AGENT_INTERVAL" => $agent_period != $arAgent["AGENT_INTERVAL"] ? $agent_period : $arAgent["AGENT_INTERVAL"], "NEXT_EXEC" => $runTime));
         }
     }
     if (file_exists($_SERVER["DOCUMENT_ROOT"] . "/bitrix/crontab/crontab.cfg")) {
         $cfgFileSize = filesize($_SERVER["DOCUMENT_ROOT"] . "/bitrix/crontab/crontab.cfg");
         $fp = fopen($_SERVER["DOCUMENT_ROOT"] . "/bitrix/crontab/crontab.cfg", "rb");
         $cfgData = fread($fp, $cfgFileSize);
         fclose($fp);
         $cfgData = preg_replace("#.*bitrix\\/modules\\/main\\/tools\\/cron_events.php(\r)*\n#i", "", $cfgData);
         $cfgData = preg_replace("#.*bitrix\\/modules\\/main\\/tools\\/cron_events.php#i", "", $cfgData);
         $cronTask = "* * * * * php -f {$_SERVER["DOCUMENT_ROOT"]}/bitrix/modules/main/tools/cron_events.php";
         $cfgData .= PHP_EOL . $cronTask . PHP_EOL;
         file_put_contents($_SERVER["DOCUMENT_ROOT"] . "/bitrix/crontab/crontab.cfg", $cfgData);
         @exec("crontab " . $_SERVER["DOCUMENT_ROOT"] . "/bitrix/crontab/crontab.cfg");
     }
     return $agent_ID;
 }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:38,代码来源:cexportproagent.php

示例3: IntVal

        $ID = IntVal($ID);
        if ($ID <= 0) {
            continue;
        }
        switch ($_REQUEST['action']) {
            case "delete":
                @set_time_limit(0);
                if (!CAgent::Delete($ID)) {
                    $lAdmin->AddGroupError(GetMessage("DELETE_ERROR"), $ID);
                }
                break;
            case "activate":
                CAgent::Update($ID, array("ACTIVE" => "Y"));
                break;
            case "deactivate":
                CAgent::Update($ID, array("ACTIVE" => "N"));
                break;
        }
    }
}
$agentList = CAgent::GetList(array($by => $order), $arFilter);
$rsData = new CAdminResult($agentList, $sTableID);
$rsData->NavStart(20);
$lAdmin->NavText($rsData->GetNavPrint(GetMessage("MAIN_AGENT_LIST_PAGE")));
$lAdmin->AddHeaders(array(array("id" => "ID", "content" => GetMessage("MAIN_AGENT_ID"), "sort" => "ID", "default" => true), array("id" => "MODULE_ID", "content" => GetMessage("MAIN_AGENT_MODULE_ID"), "sort" => "MODULE_ID", "default" => true), array("id" => "USER_ID", "content" => GetMessage("MAIN_AGENT_USER_ID"), "sort" => "USER_ID", "default" => true), array("id" => "SORT", "content" => GetMessage("MAIN_AGENT_SORT"), "sort" => "SORT"), array("id" => "NAME", "content" => GetMessage("MAIN_AGENT_NAME"), "sort" => "NAME", "default" => true), array("id" => "ACTIVE", "content" => GetMessage("MAIN_AGENT_ACTIVE"), "sort" => "ACTIVE", "default" => true), array("id" => "LAST_EXEC", "content" => GetMessage("MAIN_AGENT_LAST_EXEC"), "sort" => "LAST_EXEC", "default" => true), array("id" => "NEXT_EXEC", "content" => GetMessage("MAIN_AGENT_NEXT_EXEC"), "sort" => "NEXT_EXEC", "default" => true), array("id" => "AGENT_INTERVAL", "content" => GetMessage("MAIN_AGENT_INTERVAL"), "sort" => "AGENT_INTERVAL", "default" => true), array("id" => "IS_PERIOD", "content" => GetMessage("MAIN_AGENT_PERIOD"), "sort" => "IS_PERIOD")));
while ($db_res = $rsData->NavNext(true, "a_")) {
    $row =& $lAdmin->AddRow($a_ID, $db_res);
    $row->AddField("ID", $a_ID);
    $row->AddField("MODULE_ID", $a_MODULE_ID);
    $row->AddField("USER_ID", $a_USER_ID > 0 ? "<a href=\"/freetrix/admin/user_edit.php?ID=" . $a_USER_ID . "&lang=" . LANG . "\">[" . $a_USER_ID . "] " . $a_USER_NAME . " " . $a_LAST_NAME . " (" . $a_LOGIN . ")</a>" : GetMessage("MAIN_AGENT_SYSTEM_USER"));
    $row->AddInputField("SORT");
开发者ID:ASDAFF,项目名称:open_bx,代码行数:31,代码来源:agent_list.php

示例4: pingAgent

 /**
  * Ping from the agent to inform that it still works correctly. Use this method if your agent
  * works more 10 minutes, otherwise Bitrix will be consider your agent as non-working.
  *
  * Usage:
  * ```php
  * public function executeAgent($param1, $param2)
  * {
  *      // start a heavy (big) cycle
  *
  *          $this->pingAgent(20, ['executeAgent => [$param1, $param2]]);
  *
  *      // end of cycle
  * }
  * ```
  *
  * @param int $interval The time in minutes after which the agent will be considered non-working.
  * @param array $callChain Array with the call any methods from Agent class.
  */
 protected function pingAgent($interval, array $callChain)
 {
     if (!$this->isAgentMode()) {
         return;
     }
     $name = $this->getAgentName($callChain);
     $model = new \CAgent();
     $rsAgent = $model->GetList([], ['NAME' => $name]);
     if ($agent = $rsAgent->Fetch()) {
         $dateCheck = DateTime::createFromTimestamp(time() + $interval * 60);
         $pingResult = $model->Update($agent['ID'], ['DATE_CHECK' => $dateCheck->toString()]);
         if (!$pingResult) {
             // @todo warning
         }
     } else {
         // @todo warning
     }
 }
开发者ID:notamedia,项目名称:console-jedi,代码行数:37,代码来源:AgentTrait.php

示例5: ob_end_clean

            ob_end_clean();
            LocalRedirect($APPLICATION->GetCurPage() . '?lang=' . LANGUAGE_ID . '&mid=' . $module_id . '&' . $tabControl->ActiveTabParam());
        }
        if (isset($_POST['procedures']) && $_POST['procedures'] === 'Y' && isset($_POST['action']) && $_POST['action'] == 'recalc') {
            CCurrency::updateAllCurrencyBaseRate();
            LocalRedirect($APPLICATION->GetCurPage() . '?lang=' . LANGUAGE_ID . '&mid=' . $module_id . '&' . $systemTabControl->ActiveTabParam());
        }
        if (isset($_POST['agents']) && $_POST['agents'] == 'Y' && isset($_POST['action']) && !empty($_POST['action'])) {
            $action = (string) $_POST['action'];
            switch ($action) {
                case 'activate':
                case 'deactivate':
                    $agentIterator = CAgent::GetList(array(), array('MODULE_ID' => 'currency', '=NAME' => '\\Bitrix\\Currency\\CurrencyTable::currencyBaseRateAgent();'));
                    if ($currencyAgent = $agentIterator->Fetch()) {
                        $active = $action == 'activate' ? 'Y' : 'N';
                        CAgent::Update($currencyAgent['ID'], array('ACTIVE' => $active));
                    }
                    break;
                case 'create':
                    $checkDate = DateTime::createFromTimestamp(strtotime('tomorrow 00:01:00'));
                    CAgent::AddAgent('\\Bitrix\\Currency\\CurrencyTable::currencyBaseRateAgent();', 'currency', 'Y', 86400, '', 'Y', $checkDate->toString(), 100, false, true);
                    break;
            }
            LocalRedirect($APPLICATION->GetCurPage() . '?lang=' . LANGUAGE_ID . '&mid=' . $module_id . '&' . $systemTabControl->ActiveTabParam());
        }
    }
    $baseCurrency = Currency\CurrencyManager::getBaseCurrency();
    $tabControl->Begin();
    ?>
	<form method="POST" action="<?php 
    echo $APPLICATION->GetCurPage();
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:options.php

示例6: array

         $res = CCrmExternalSale::Add($arFields);
     }
     if (!$res) {
         if ($ex = $GLOBALS["APPLICATION"]->GetException()) {
             $errorMessage .= $ex->GetString() . ".<br>";
         } else {
             $errorMessage .= "Unknown error." . "<br>";
         }
     }
 }
 if (strlen($errorMessage) <= 0) {
     $dbAgents = CAgent::GetList(array(), array("NAME" => "CCrmExternalSaleImport::DataSync(" . intval($res) . ");", "MODULE_ID" => "crm"));
     if ($arAgent = $dbAgents->Fetch()) {
         if ($arResult["BP"]["DATA_SYNC_PERIOD"] > 0) {
             if ($arAgent["ACTIVE"] != "Y" || intval($arAgent["AGENT_INTERVAL"] / 60) != $arResult["BP"]["DATA_SYNC_PERIOD"]) {
                 CAgent::Update($arAgent["ID"], array("ACTIVE" => "Y", "AGENT_INTERVAL" => 60 * $arResult["BP"]["DATA_SYNC_PERIOD"]));
             }
         } else {
             CAgent::RemoveAgent("CCrmExternalSaleImport::DataSync(" . intval($res) . ");", "crm");
         }
     } else {
         if ($arResult["BP"]["DATA_SYNC_PERIOD"] > 0) {
             CAgent::AddAgent("CCrmExternalSaleImport::DataSync(" . intval($res) . ");", "crm", "N", 60 * $arResult["BP"]["DATA_SYNC_PERIOD"]);
         }
     }
     if (isset($_POST['apply'])) {
         LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_EDIT"], array("id" => intval($res))));
     }
     LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_SYNC"], array("id" => intval($res))));
     //LocalRedirect($arResult["PATH_TO_INDEX"]);
 } else {
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例7: intval

         }
         $tSwitch = 'N';
         if (isset($_POST['tracking_check_switch']) && $_POST['tracking_check_switch'] == 'Y') {
             $tSwitch = 'Y';
         }
         Option::set('sale', 'tracking_check_switch', $tSwitch);
         $tPeriod = 0;
         if (isset($_POST['tracking_check_period']) && intval($_POST['tracking_check_period']) > 0) {
             $tPeriod = intval($_POST['tracking_check_period']);
         }
         Option::set('sale', 'tracking_check_period', $tPeriod);
         $agentName = '\\Bitrix\\Sale\\Delivery\\Tracking\\Manager::startRefreshingStatuses();';
         if ($tSwitch == 'Y' && $tPeriod > 0) {
             $res = \CAgent::GetList(array(), array('NAME' => $agentName));
             if ($agent = $res->Fetch()) {
                 \CAgent::Update($agent['ID'], array('AGENT_INTERVAL' => $tPeriod * 60 * 60));
             } else {
                 \CAgent::AddAgent($agentName, 'sale', "Y", $tPeriod * 60 * 60, "", "Y");
             }
         } else {
             \CAgent::RemoveAgent($agentName, 'sale');
         }
     }
 }
 $arStatuses = array("" => GetMessage("SMO_STATUS"));
 $dbStatus = CSaleStatus::GetList(array("SORT" => "ASC"), array("LID" => LANGUAGE_ID), false, false, array("ID", "NAME", "SORT"));
 while ($arStatus = $dbStatus->GetNext()) {
     $arStatuses[$arStatus["ID"]] = "[" . $arStatus["ID"] . "] " . $arStatus["NAME"];
 }
 if ($strWarning != '') {
     CAdminMessage::ShowMessage($strWarning);
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:options.php

示例8: update

 /**
  * Update agent's params.
  * @param string $siteId Site id.
  * @param array $feedSettings Feed settings.
  * @return array Feed settings with renew agents ids.
  */
 public static function update($siteId, array $feedSettings)
 {
     foreach ($feedSettings as $feedType => $feedParams) {
         $interval = intval($feedParams["INTERVAL"]);
         $dbRes = \CAgent::GetList(array(), array('NAME' => self::createAgentNameForAdd($feedType, $siteId)));
         if ($agent = $dbRes->Fetch()) {
             if ($interval <= 0) {
                 \CAgent::Delete($agent["ID"]);
                 $feedSettings[$feedType]["AGENT_ID"] = 0;
                 continue;
             }
             \CAgent::Update($agent["ID"], array('AGENT_INTERVAL' => $interval * 60));
             $feedSettings[$feedType]["AGENT_ID"] = $agent["ID"];
         } else {
             $feedSettings[$feedType]["AGENT_ID"] = self::add($feedType, $siteId, $feedParams["INTERVAL"]);
         }
     }
     return $feedSettings;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:25,代码来源:agent.php

示例9: GetMessage

if ($ID > 0) {
    $res = CAgent::GetById($ID);
    $arr = $res->ExtractFields("a_");
}
$APPLICATION->SetTitle($ID <= 0 ? GetMessage("MAIN_AGENT_NEW_PAGE_TITLE") : str_replace("#ID#", " {$ID}", GetMessage("MAIN_AGENT_EDIT_PAGE_TITLE")));
$sTableID = "tbl_agent_edit";
$aTabs = array(array("DIV" => "tab1", "TAB" => GetMessage("MAIN_AGENT_TAB"), "ICON" => "main_user_edit", "TITLE" => GetMessage("MAIN_AGENT_TAB_TITLE")));
$editTab = new CAdminTabControl("editTab", $aTabs);
$APPLICATION->ResetException();
if ($REQUEST_METHOD == "POST" && (strlen($save) > 0 || strlen($apply) > 0) && $isAdmin && check_bitrix_sessid()) {
    $arFields = array("NAME" => $NAME, "MODULE_ID" => $MODULE_ID, "ACTIVE" => $ACTIVE, "SORT" => $SORT, "IS_PERIOD" => $IS_PERIOD, "AGENT_INTERVAL" => $AGENT_INTERVAL, "NEXT_EXEC" => $NEXT_EXEC, "USER_ID" => false);
    if (intval($USER_ID) > 0) {
        $arFields["USER_ID"] = $USER_ID;
    }
    if ($ID > 0) {
        $res = CAgent::Update($ID, $arFields);
    } else {
        $ID = CAgent::Add($arFields);
        $res = $ID > 0;
    }
    if ($res) {
        if (strlen($save) > 0) {
            LocalRedirect("/bitrix/admin/agent_list.php");
        } elseif (strlen($apply) > 0) {
            LocalRedirect("/bitrix/admin/agent_edit.php?&ID=" . $ID . "&" . $editTab->ActiveTabParam());
        }
    }
}
require $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/include/prolog_admin_after.php";
$aMenu = array(array("TEXT" => GetMessage("MAIN_AGENT_RECORD_LIST"), "LINK" => "/bitrix/admin/agent_list.php?lang=" . LANG, "ICON" => "btn_list", "TITLE" => GetMessage("MAIN_AGENT_RECORD_LIST_TITLE")));
if ($ID > 0) {
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:agent_edit.php

示例10: intval

        $res = CCrmExternalSale::Update($id, $arFields);
        if (!$res) {
            if ($ex = $GLOBALS["APPLICATION"]->GetException()) {
                $errorMessage .= $ex->GetString() . ".<br>";
            } else {
                $errorMessage .= "Unknown error." . "<br>";
            }
        }
    }
    if (empty($errorMessage)) {
        $dataSyncPeriod = intval($_REQUEST["DATA_SYNC_PERIOD"]);
        $dbAgents = CAgent::GetList(array(), array("NAME" => "CCrmExternalSaleImport::DataSync(" . $id . ");", "MODULE_ID" => "crm"));
        if ($arAgent = $dbAgents->Fetch()) {
            if ($dataSyncPeriod > 0) {
                if ($arAgent["ACTIVE"] != "Y" || intval($arAgent["AGENT_INTERVAL"] / 60) != $dataSyncPeriod) {
                    CAgent::Update($arAgent["ID"], array("ACTIVE" => "Y", "AGENT_INTERVAL" => 60 * $dataSyncPeriod));
                }
            } else {
                CAgent::RemoveAgent("CCrmExternalSaleImport::DataSync(" . $id . ");", "crm");
            }
        } else {
            if ($dataSyncPeriod > 0) {
                CAgent::AddAgent("CCrmExternalSaleImport::DataSync(" . $id . ");", "crm", "N", 60 * $dataSyncPeriod);
            }
        }
    }
}
if ($processActions && !empty($errorMessage)) {
    $currentStep--;
}
?>
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:wizard.php


注:本文中的CAgent::Update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。