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


PHP zbx_array_mintersect函数代码示例

本文整理汇总了PHP中zbx_array_mintersect函数的典型用法代码示例。如果您正苦于以下问题:PHP zbx_array_mintersect函数的具体用法?PHP zbx_array_mintersect怎么用?PHP zbx_array_mintersect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: exists

 /**
  * Check if application exists.
  *
  * @deprecated	As of version 2.4, use get method instead.
  *
  * @param array	$object
  *
  * @return bool
  */
 public function exists(array $object)
 {
     $this->deprecated('application.exists method is deprecated.');
     $application = $this->get(array('output' => array('applicationid'), 'filter' => zbx_array_mintersect(array(array('hostid', 'host'), 'name'), $object), 'limit' => 1));
     return (bool) $application;
 }
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:15,代码来源:CApplication.php

示例2: exists

 public function exists($data)
 {
     $keyFields = array(array('screenid', 'name'), 'templateid');
     $options = array('filter' => zbx_array_mintersect($keyFields, $data), 'preservekeys' => true, 'output' => API_OUTPUT_SHORTEN, 'nopermissions' => true, 'limit' => 1);
     if (isset($data['node'])) {
         $options['nodeids'] = getNodeIdByNodeName($data['node']);
     } elseif (isset($data['nodeids'])) {
         $options['nodeids'] = $data['nodeids'];
     }
     $screens = $this->get($options);
     return !empty($screens);
 }
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:12,代码来源:CTemplateScreen.php

示例3: exists

 /**
  * Is interface exist.
  *
  * @param array $object
  *
  * @return bool
  */
 public function exists(array $object)
 {
     $keyFields = array('interfaceid', 'hostid', 'ip', 'dns');
     $options = array('filter' => zbx_array_mintersect($keyFields, $object), 'output' => array('interfaceid'), 'nopermissions' => true, 'limit' => 1);
     if (isset($object['node'])) {
         $options['nodeids'] = getNodeIdByNodeName($object['node']);
     } elseif (isset($object['nodeids'])) {
         $options['nodeids'] = $object['nodeids'];
     }
     $objs = $this->get($options);
     return !empty($objs);
 }
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:19,代码来源:CHostInterface.php

示例4: exists

 /**
  * @param $object
  *
  * @return bool
  */
 public function exists(array $object)
 {
     $keyFields = array(array('hostid', 'host'), 'description');
     $result = false;
     if (!isset($object['hostid']) && !isset($object['host'])) {
         $expressionData = new CTriggerExpression();
         if (!$expressionData->parse($object['expression'])) {
             return false;
         }
         $expressionHosts = $expressionData->getHosts();
         $object['host'] = reset($expressionHosts);
     }
     $options = array('filter' => array_merge(zbx_array_mintersect($keyFields, $object), array('flags' => null)), 'output' => API_OUTPUT_EXTEND, 'nopermissions' => true);
     if (isset($object['node'])) {
         $options['nodeids'] = getNodeIdByNodeName($object['node']);
     } elseif (isset($object['nodeids'])) {
         $options['nodeids'] = $object['nodeids'];
     }
     $triggers = $this->get($options);
     foreach ($triggers as $trigger) {
         $tmpExp = explode_exp($trigger['expression']);
         if (strcmp($tmpExp, $object['expression']) == 0) {
             $result = true;
             break;
         }
     }
     return $result;
 }
开发者ID:itnihao,项目名称:Zabbix_,代码行数:33,代码来源:CTrigger.php

示例5: updateReal

 /**
  * Updates the host prototypes and propagates the changes to linked hosts and templates.
  *
  * @param array $hostPrototypes
  *
  * @return array
  */
 protected function updateReal(array $hostPrototypes)
 {
     // save the host prototypes
     foreach ($hostPrototypes as $hostPrototype) {
         DB::updateByPk($this->tableName(), $hostPrototype['hostid'], $hostPrototype);
     }
     $exHostPrototypes = $this->get(['output' => ['hostid'], 'selectGroupLinks' => API_OUTPUT_EXTEND, 'selectGroupPrototypes' => API_OUTPUT_EXTEND, 'selectTemplates' => ['templateid'], 'selectInventory' => API_OUTPUT_EXTEND, 'hostids' => zbx_objectValues($hostPrototypes, 'hostid'), 'preservekeys' => true]);
     // update related objects
     $inventoryCreate = [];
     $inventoryDeleteIds = [];
     foreach ($hostPrototypes as $key => $hostPrototype) {
         $exHostPrototype = $exHostPrototypes[$hostPrototype['hostid']];
         // group prototypes
         if (isset($hostPrototype['groupPrototypes'])) {
             foreach ($hostPrototype['groupPrototypes'] as &$groupPrototype) {
                 $groupPrototype['hostid'] = $hostPrototype['hostid'];
             }
             unset($groupPrototype);
             // save group prototypes
             $exGroupPrototypes = zbx_toHash(array_merge($exHostPrototype['groupLinks'], $exHostPrototype['groupPrototypes']), 'group_prototypeid');
             $modifiedGroupPrototypes = [];
             foreach ($hostPrototype['groupPrototypes'] as $groupPrototype) {
                 if (isset($groupPrototype['group_prototypeid'])) {
                     unset($exGroupPrototypes[$groupPrototype['group_prototypeid']]);
                 }
                 $modifiedGroupPrototypes[] = $groupPrototype;
             }
             if ($exGroupPrototypes) {
                 $this->deleteGroupPrototypes(array_keys($exGroupPrototypes));
             }
             $hostPrototypes[$key]['groupPrototypes'] = DB::save('group_prototype', $modifiedGroupPrototypes);
         }
         // templates
         if (isset($hostPrototype['templates'])) {
             $existingTemplateIds = zbx_objectValues($exHostPrototype['templates'], 'templateid');
             $newTemplateIds = zbx_objectValues($hostPrototype['templates'], 'templateid');
             $this->unlink(array_diff($existingTemplateIds, $newTemplateIds), [$hostPrototype['hostid']]);
             $this->link(array_diff($newTemplateIds, $existingTemplateIds), [$hostPrototype['hostid']]);
         }
         // inventory
         if (isset($hostPrototype['inventory'])) {
             $inventory = zbx_array_mintersect(['inventory_mode'], $hostPrototype['inventory']);
             $inventory['hostid'] = $hostPrototype['hostid'];
             if ($hostPrototype['inventory'] && (!isset($hostPrototype['inventory']['inventory_mode']) || $hostPrototype['inventory']['inventory_mode'] != HOST_INVENTORY_DISABLED)) {
                 if ($exHostPrototype['inventory']) {
                     DB::update('host_inventory', ['values' => $inventory, 'where' => ['hostid' => $inventory['hostid']]]);
                 } else {
                     $inventoryCreate[] = $inventory;
                 }
             } else {
                 $inventoryDeleteIds[] = $hostPrototype['hostid'];
             }
         }
     }
     // save inventory
     DB::insert('host_inventory', $inventoryCreate, false);
     DB::delete('host_inventory', ['hostid' => $inventoryDeleteIds]);
     // TODO: REMOVE info
     $updatedHostPrototypes = $this->get(['hostids' => zbx_objectValues($hostPrototypes, 'hostid'), 'output' => ['host'], 'selectParentHost' => ['host'], 'nopermissions' => true]);
     foreach ($updatedHostPrototypes as $hostProtototype) {
         info(_s('Updated: Host prototype "%1$s" on "%2$s".', $hostProtototype['host'], $hostProtototype['parentHost']['host']));
     }
     return $hostPrototypes;
 }
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:71,代码来源:CHostPrototype.php

示例6: exists

 public function exists($object)
 {
     $keyFields = array(array('dserviceid'));
     $options = array('filter' => zbx_array_mintersect($keyFields, $object), 'output' => API_OUTPUT_SHORTEN, 'nopermissions' => 1, 'limit' => 1);
     if (isset($object['node'])) {
         $options['nodeids'] = getNodeIdByNodeName($object['node']);
     } elseif (isset($object['nodeids'])) {
         $options['nodeids'] = $object['nodeids'];
     }
     $objs = $this->get($options);
     return !empty($objs);
 }
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:12,代码来源:CDService.php

示例7: exists

 public static function exists($object)
 {
     $keyFields = array(array('hostid', 'host'), 'description');
     $result = false;
     if (!isset($object['hostid']) && !isset($object['host'])) {
         $expr = new CTriggerExpression($object);
         $expression = $object['expression'];
         if (!empty($expr->errors)) {
             return false;
         }
         if (empty($expr->data['hosts'])) {
             return false;
         }
         $object['host'] = reset($expr->data['hosts']);
     }
     $options = array('filter' => zbx_array_mintersect($keyFields, $object), 'output' => API_OUTPUT_EXTEND, 'nopermissions' => 1);
     if (isset($object['node'])) {
         $options['nodeids'] = getNodeIdByNodeName($object['node']);
     } else {
         if (isset($object['nodeids'])) {
             $options['nodeids'] = $object['nodeids'];
         }
     }
     $triggers = self::get($options);
     foreach ($triggers as $tnum => $trigger) {
         $tmp_exp = explode_exp($trigger['expression'], false);
         if (strcmp($tmp_exp, $object['expression']) == 0) {
             $result = true;
             break;
         }
     }
     return $result;
 }
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:33,代码来源:class.ctrigger.php

示例8: exists

 /**
  * Check if host group exists.
  *
  * @deprecated	As of version 2.4, use get method instead.
  *
  * @param array	$object
  *
  * @return bool
  */
 public function exists(array $object)
 {
     $this->deprecated('hostgroup.exists method is deprecated.');
     $hostGroup = $this->get(array('output' => array('groupid'), 'filter' => zbx_array_mintersect(array('name', 'groupid'), $object), 'limit' => 1));
     return (bool) $hostGroup;
 }
开发者ID:unix1986,项目名称:zabbix,代码行数:15,代码来源:CHostGroup.php

示例9: exists

 public static function exists($object)
 {
     $keyFields = array('name', 'groupid');
     $options = array('filter' => zbx_array_mintersect($keyFields, $object), 'output' => API_OUTPUT_SHORTEN, 'nopermissions' => 1, 'limit' => 1);
     if (isset($object['node'])) {
         $options['nodeids'] = getNodeIdByNodeName($object['node']);
     } else {
         if (isset($object['nodeids'])) {
             $options['nodeids'] = $object['nodeids'];
         }
     }
     $objs = self::get($options);
     return !empty($objs);
 }
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:14,代码来源:class.chostgroup.php

示例10: exists

 /**
  * Check if trigger exists.
  *
  * @deprecated	As of version 2.4, use get method instead.
  *
  * @param array $object
  *
  * @return bool
  */
 public function exists(array $object)
 {
     $this->deprecated('trigger.exists method is deprecated.');
     $keyFields = array(array('hostid', 'host'), 'description');
     $result = false;
     if (!isset($object['hostid']) && !isset($object['host'])) {
         $expressionData = new CTriggerExpression();
         if (!$expressionData->parse($object['expression'])) {
             return false;
         }
         $expressionHosts = $expressionData->getHosts();
         $object['host'] = reset($expressionHosts);
     }
     $triggers = $this->get(array('filter' => array_merge(zbx_array_mintersect($keyFields, $object), array('flags' => null)), 'output' => API_OUTPUT_EXTEND));
     foreach ($triggers as $trigger) {
         $tmpExp = explode_exp($trigger['expression']);
         if (strcmp($tmpExp, $object['expression']) == 0) {
             $result = true;
             break;
         }
     }
     return $result;
 }
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:32,代码来源:CTrigger.php

示例11: exists

 /**
  * Check if discovered host exists.
  *
  * @deprecated	As of version 2.4, use get method instead.
  *
  * @param array	$object
  *
  * @return bool
  */
 public function exists(array $object)
 {
     $this->deprecated('dhost.exists method is deprecated.');
     $dHost = $this->get(array('output' => array('dhostid'), 'filter' => zbx_array_mintersect(array(array('dhostid')), $object), 'limit' => 1));
     return (bool) $dHost;
 }
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:15,代码来源:CDHost.php

示例12: exists

 /**
  * Check if template screen exists.
  *
  * @deprecated	As of version 2.4, use get method instead.
  *
  * @param array	$object
  *
  * @return bool
  */
 public function exists(array $object)
 {
     $this->deprecated('templatescreen.exists method is deprecated.');
     $templateScreen = $this->get(array('output' => array('screenid'), 'filter' => zbx_array_mintersect(array(array('screenid', 'name'), 'templateid'), $object), 'preservekeys' => true, 'limit' => 1));
     return (bool) $templateScreen;
 }
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:15,代码来源:CTemplateScreen.php

示例13: exists

 public static function exists($data)
 {
     $keyFields = array(array('screenid', 'name'));
     $options = array('filter' => zbx_array_mintersect($keyFields, $data), 'output' => API_OUTPUT_SHORTEN, 'nopermissions' => 1, 'limit' => 1);
     if (isset($data['node'])) {
         $options['nodeids'] = getNodeIdByNodeName($data['node']);
     } else {
         if (isset($data['nodeids'])) {
             $options['nodeids'] = $data['nodeids'];
         }
     }
     $sysmaps = self::get($options);
     return !empty($sysmaps);
 }
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:14,代码来源:class.cscreen.php

示例14: exists

 /**
  * Check if host interface exists.
  *
  * @deprecated	As of version 2.4, use get method instead.
  *
  * @param array	$object
  *
  * @return bool
  */
 public function exists(array $object)
 {
     $this->deprecated('hostinterface.exists method is deprecated.');
     $hostInterface = $this->get(array('output' => array('interfaceid'), 'filter' => zbx_array_mintersect(array('interfaceid', 'hostid', 'ip', 'dns'), $object), 'limit' => 1));
     return (bool) $hostInterface;
 }
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:15,代码来源:CHostInterface.php

示例15: exists

 /**
  * Check if maintenance exists.
  *
  * @deprecated	As of version 2.4, use get method instead.
  *
  * @param array	$object
  *
  * @return bool
  */
 public function exists(array $object)
 {
     $this->deprecated('maintenance.exists method is deprecated.');
     $keyFields = array(array('maintenanceid', 'name'));
     $maintenance = $this->get(array('output' => array('maintenanceid'), 'filter' => zbx_array_mintersect($keyFields, $object), 'limit' => 1));
     return (bool) $maintenance;
 }
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:16,代码来源:CMaintenance.php


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