Example #1
0
 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);
 }